From 423347dbe548a2784d356d6b2af7be60d8f2f136 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Fri, 20 Oct 2023 14:00:38 +0300 Subject: [PATCH] cope with bad exif error --- core/views/editor_helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/views/editor_helpers.py b/core/views/editor_helpers.py index 179d4a1..91ba01e 100644 --- a/core/views/editor_helpers.py +++ b/core/views/editor_helpers.py @@ -94,7 +94,11 @@ def new_image_form(request, path): exif_dict = piexif.load(i.info["exif"]) i = reorient_image(i, exif_dict) exif_dict['Exif'][41729] = b'1' - exif = piexif.dump(exif_dict) + # can crash here with bad exif data + try: + exif = piexif.dump(exif_dict) + except: + exif = None else: exif = None