Skip to content

Commit

Permalink
fix thumbnail generation error for even biggetr files, in filer_gui_t…
Browse files Browse the repository at this point in the history
…ags/changelist/imagefield
  • Loading branch information
benzkji committed Aug 4, 2022
1 parent f0e0563 commit 371f54a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion filer_addons/filer_gui/templatetags/filer_gui_tags.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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'
Expand Down

0 comments on commit 371f54a

Please sign in to comment.