From 371f54a813bb9b9ccc6f2454940cef2edbdb6596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ben=20St=C3=A4hli?= Date: Thu, 4 Aug 2022 08:53:23 +0200 Subject: [PATCH] fix thumbnail generation error for even biggetr files, in filer_gui_tags/changelist/imagefield --- filer_addons/filer_gui/templatetags/filer_gui_tags.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/filer_addons/filer_gui/templatetags/filer_gui_tags.py b/filer_addons/filer_gui/templatetags/filer_gui_tags.py index 13a273a..e29309e 100644 --- a/filer_addons/filer_gui/templatetags/filer_gui_tags.py +++ b/filer_addons/filer_gui/templatetags/filer_gui_tags.py @@ -1,6 +1,8 @@ from django import template +from easy_thumbnails.engine import NoSourceGenerator from easy_thumbnails.exceptions import InvalidImageFormatError from easy_thumbnails.files import get_thumbnailer +# TODO: remove this again, as the NoSourceGenerator exception is now handled? # support very big images # https://stackoverflow.com/questions/51152059/pillow-in-python-wont-let-me-open-image-exceeds-limit import PIL.Image @@ -23,7 +25,7 @@ def filer_gui_file_thumb(obj, context='change_list'): thumbnail_options = {'size': conf.FIELD_THUMB_SIZE} try: return thumbnailer.get_thumbnail(thumbnail_options).url - except (InvalidImageFormatError, FileNotFoundError): + except (InvalidImageFormatError, NoSourceGenerator, FileNotFoundError): pass if obj.file and obj.file.path.endswith('.pdf'): return '/static/filer/icons/file-pdf.svg'