summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2021-06-20 12:59:02 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2021-06-20 12:59:02 (GMT)
commitc7c3336b167783313ff1ffdbeddb5a65e3c467eb (patch)
tree8413397c4d694df9ee2c9e1acffa548a23d1d625
parent850ddaefe574fc2ed5d5dca97f2ab076c05d1c4c (diff)
downloaddjango-ckeditor-c7c3336b167783313ff1ffdbeddb5a65e3c467eb.zip
django-ckeditor-c7c3336b167783313ff1ffdbeddb5a65e3c467eb.tar.gz
django-ckeditor-c7c3336b167783313ff1ffdbeddb5a65e3c467eb.tar.bz2
misc: create thumbnail as jpeg in case of unknown file format (#54667)
-rw-r--r--ckeditor/image/pillow_backend.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ckeditor/image/pillow_backend.py b/ckeditor/image/pillow_backend.py
index 74db2af..a888c5c 100644
--- a/ckeditor/image/pillow_backend.py
+++ b/ckeditor/image/pillow_backend.py
@@ -24,7 +24,10 @@ def image_verify(f):
def create_thumbnail(file_path):
thumbnail_filename = utils.get_thumb_filename(file_path)
- thumbnail_format = utils.get_image_format(os.path.splitext(file_path)[1])
+ try:
+ thumbnail_format = utils.get_image_format(os.path.splitext(file_path)[1])
+ except KeyError:
+ thumbnail_format = 'image/jpeg'
file_format = thumbnail_format.split('/')[1]
image = default_storage.open(file_path)