From 7a0cd18abcfceae46eda7a5e09acc50b131d678c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=90=D1=88=D0=BA=D0=BE=D0=B2?= Date: Fri, 31 Oct 2025 09:21:07 +0300 Subject: [PATCH 1/2] Fix: Handle missing files in MinIO storage by catching Exception in get_attrs --- image_cropping/widgets.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/image_cropping/widgets.py b/image_cropping/widgets.py index cce88f05..6c86af72 100644 --- a/image_cropping/widgets.py +++ b/image_cropping/widgets.py @@ -40,8 +40,12 @@ def get_attrs(image, name): width, height = get_backend().get_size(image) except AttributeError: # invalid image -> AttributeError - width = image.width - height = image.height + try: + width = image.width + height = image.height + except: + width = None + height = None return { "class": "crop-thumb", "data-thumbnail-url": thumbnail_url(image), From 088466f6156c7d76864e6930267e5c9433fd0c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=90=D1=88=D0=BA=D0=BE=D0=B2?= Date: Fri, 31 Oct 2025 15:00:16 +0300 Subject: [PATCH 2/2] Fix: Additional exception handler on missing files in get_attrs --- image_cropping/widgets.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/image_cropping/widgets.py b/image_cropping/widgets.py index 6c86af72..ad8802cc 100644 --- a/image_cropping/widgets.py +++ b/image_cropping/widgets.py @@ -46,6 +46,10 @@ def get_attrs(image, name): except: width = None height = None + except Exception as e: + logger.error(e.__str__()) + width = None + height = None return { "class": "crop-thumb", "data-thumbnail-url": thumbnail_url(image),