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