Fix uploaded photos saved as empty files after Pillow verify()
This commit is contained in:
parent
a43d91fc50
commit
4c4203f335
1 changed files with 1 additions and 0 deletions
|
|
@ -272,6 +272,7 @@ class GalleryUpload(PermissionRequiredMixin, FormView):
|
|||
try:
|
||||
opened = Image.open(photo_file)
|
||||
opened.verify()
|
||||
photo_file.seek(0)
|
||||
except Exception:
|
||||
# Pillow doesn't recognize it as an image, skip it
|
||||
messages.error(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue