Bläddra i källkod

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

Brian Tiemann 1 år sedan
förälder
incheckning
81108e405f
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      netbox/extras/utils.py

+ 1 - 1
netbox/extras/utils.py

@@ -33,7 +33,7 @@ def image_upload(instance, filename):
 
 
     # Rename the file to the provided name, if any. Attempt to preserve the file extension.
     # Rename the file to the provided name, if any. Attempt to preserve the file extension.
     extension = filename.rsplit('.')[-1].lower()
     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])
         filename = '.'.join([instance.name, extension])
     elif instance.name:
     elif instance.name:
         filename = instance.name
         filename = instance.name