mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-18 13:06:30 -06:00
Preserve fileextension, regardless of upper or lower case on imageuploads
This commit is contained in:
parent
cd5a86bfcf
commit
e08107063a
@ -387,7 +387,7 @@ def image_upload(instance, filename):
|
||||
path = 'image-attachments/'
|
||||
|
||||
# Rename the file to the provided name, if any. Attempt to preserve the file extension.
|
||||
extension = filename.rsplit('.')[-1]
|
||||
extension = filename.rsplit('.')[-1].lower()
|
||||
if instance.name and extension in ['bmp', 'gif', 'jpeg', 'jpg', 'png']:
|
||||
filename = '.'.join([instance.name, extension])
|
||||
elif instance.name:
|
||||
|
Loading…
Reference in New Issue
Block a user