Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
BUG: handle skipped lines for upload response
Browse files Browse the repository at this point in the history
see 2/3 #33
  • Loading branch information
Sebastian Wagner committed Sep 20, 2017
1 parent 9ae5fb8 commit 95620e0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions intelmq_webinput_csv/bin/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def handle_parameters(form):
zip(parameters['columns'],
parameters['use_column'])]
parameters['skipInitialLines'] = int(parameters['skipInitialLines'])
parameters['has_header'] = json.loads(parameters['has_header'])
parameters['loadLinesMax'] = int(parameters['loadLinesMax'])
return parameters

Expand Down Expand Up @@ -166,12 +167,10 @@ def upload_file():
if parameters['has_header'] and lineindex == 1:
for _ in range(parameters['skipInitialLines']):
line = next(reader)
lineindex += 1
elif not parameters['has_header'] and lineindex == 0:
for _ in range(parameters['skipInitialLines']):
line = next(reader)
lineindex += 1
if lineindex >= parameters['loadLinesMax']:
if lineindex >= parameters['loadLinesMax'] + parameters['has_header']:
break
if valid_ip_addresses is None:
valid_ip_addresses = [0] * len(line)
Expand Down

0 comments on commit 95620e0

Please sign in to comment.