Fix uploaded photos saved as empty files after Pillow verify()

This commit is contained in:
krek0 2026-05-07 13:49:03 +02:00
parent a43d91fc50
commit 4c4203f335

View file

@ -272,6 +272,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(