mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Merge pull request #1315 from s11-charendt/develop
Preserve fileextension, regardless of upper or lower case on imageupload
This commit is contained in:
@ -387,7 +387,7 @@ def image_upload(instance, filename):
|
|||||||
path = 'image-attachments/'
|
path = 'image-attachments/'
|
||||||
|
|
||||||
# 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]
|
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']:
|
||||||
filename = '.'.join([instance.name, extension])
|
filename = '.'.join([instance.name, extension])
|
||||||
elif instance.name:
|
elif instance.name:
|
||||||
|
Reference in New Issue
Block a user