Skip to content

Commit

Permalink
upload: fix call to missing peek method
Browse files Browse the repository at this point in the history
  • Loading branch information
timonegk committed Oct 13, 2019
1 parent eb422ac commit ffa4b2d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion imagetagger/imagetagger/images/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ def upload_image(request, imageset_id):
'unsupported': False,
'zip': False,
}
if f.peek(4) == b'PK\x03\x04': # ZIP file magic number
magic_number = f.read(4)
f.seek(0) # reset file cursor to the beginning of the file
if magic_number == b'PK\x03\x04': # ZIP file magic number
error['zip'] = True
zipname = ''.join(random.choice(string.ascii_uppercase +
string.ascii_lowercase +
Expand Down

0 comments on commit ffa4b2d

Please sign in to comment.