misc: create thumbnail as jpeg in case of unknown file format (#54667)

This commit is contained in:
Frédéric Péters 2021-06-20 14:59:02 +02:00
parent 850ddaefe5
commit c7c3336b16
1 changed files with 4 additions and 1 deletions

View File

@ -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)