image-attachments upload does not sanitize . (dot) in filename and file suffix missing #10356

Closed
opened 2025-12-29 21:30:25 +01:00 by adam · 3 comments
Owner

Originally created by @ypid on GitHub (Oct 11, 2024).

Originally assigned to: @bctiemann on GitHub.

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.3

Python Version

3.10

Steps to Reproduce

  1. Upload webp image on https://demo.netbox.dev/extras/image-attachments/add/?object_type=60&object_id=1 and name it "Test image that contains . dot".

Expected Behavior

Image should be saved as https://demo.netbox.dev/media/image-attachments/module_type_1_Test_image_that_contains___dot.webp

Observed Behavior

Image was saved as https://demo.netbox.dev/media/image-attachments/module_type_1_Test_image_that_contains_._dot

Originally created by @ypid on GitHub (Oct 11, 2024). Originally assigned to: @bctiemann on GitHub. ### Deployment Type Self-hosted ### Triage priority N/A ### NetBox Version v4.1.3 ### Python Version 3.10 ### Steps to Reproduce 1. Upload webp image on https://demo.netbox.dev/extras/image-attachments/add/?object_type=60&object_id=1 and name it "Test image that contains . dot". ### Expected Behavior Image should be saved as https://demo.netbox.dev/media/image-attachments/module_type_1_Test_image_that_contains___dot.webp ### Observed Behavior Image was saved as https://demo.netbox.dev/media/image-attachments/module_type_1_Test_image_that_contains_._dot
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:30:25 +01:00
adam closed this issue 2025-12-29 21:30:25 +01:00
Author
Owner

@arthanson commented on GitHub (Oct 11, 2024):

@ypid I get the file suffix and it seems to work with the extra dot, are you seeing a specific issue when it has the extra dot?

@arthanson commented on GitHub (Oct 11, 2024): @ypid I get the file suffix and it seems to work with the extra dot, are you seeing a specific issue when it has the extra dot?
Author
Owner

@ypid commented on GitHub (Oct 11, 2024):

@arthanson You are not able to reproduce this? I am testing with Firefox 128.3.1esr (64-bit) against https://demo.netbox.dev
How is the file called for you? Is the dot in the middle of the file name sanitized for you?

@ypid commented on GitHub (Oct 11, 2024): @arthanson You are not able to reproduce this? I am testing with Firefox 128.3.1esr (64-bit) against https://demo.netbox.dev How is the file called for you? Is the dot in the middle of the file name sanitized for you?
Author
Owner

@ypid commented on GitHub (Oct 12, 2024):

I retested it. When you upload a PNG file test.png, the file suffix .png is added to the sanitized name and used as filename.

For webp, it is not added. So when you download this image, you will have a file called module_type_1_Test_image_that_contains_._dot on your filesystem. By convention, the filetype should be in the end of the filename.

@ypid commented on GitHub (Oct 12, 2024): I retested it. When you upload a PNG file `test.png`, the file suffix `.png` is added to the sanitized name and used as filename. For webp, it is not added. So when you download this image, you will have a file called `module_type_1_Test_image_that_contains_._dot` on your filesystem. By convention, the filetype should be in the end of the filename.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10356