Add webp to the list of acceptable extensions for handling filenames in image_upload

This commit is contained in:
Brian Tiemann 2024-10-16 14:39:13 -04:00
parent 24ec13c9e6
commit 9bb6598056

View File

@ -33,7 +33,7 @@ def image_upload(instance, filename):
# Rename the file to the provided name, if any. Attempt to preserve the file extension.
extension = filename.rsplit('.')[-1].lower()
if instance.name and extension in ['bmp', 'gif', 'jpeg', 'jpg', 'png']:
if instance.name and extension in ['bmp', 'gif', 'jpeg', 'jpg', 'png', 'webp']:
filename = '.'.join([instance.name, extension])
elif instance.name:
filename = instance.name