Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ypid opened this issue Oct 11, 2024 · 3 comments · Fixed by #17788
Closed

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

ypid opened this issue Oct 11, 2024 · 3 comments · Fixed by #17788
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@ypid
Copy link
Contributor

ypid commented Oct 11, 2024

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

@ypid ypid added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Oct 11, 2024
@ypid ypid changed the title image-attachments upload does not sanitize . (dot) in filename image-attachments upload does not sanitize . (dot) in filename and file suffix missing Oct 11, 2024
@arthanson
Copy link
Collaborator

@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 arthanson added status: revisions needed This issue requires additional information to be actionable and removed status: needs triage This issue is awaiting triage by a maintainer labels Oct 11, 2024
@ypid
Copy link
Contributor Author

ypid commented 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
Copy link
Contributor Author

ypid commented 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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
3 participants