From c7c3336b167783313ff1ffdbeddb5a65e3c467eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 20 Jun 2021 14:59:02 +0200 Subject: [PATCH] misc: create thumbnail as jpeg in case of unknown file format (#54667) --- ckeditor/image/pillow_backend.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)