Skip to content

Duplicate filename allowed when upload files using S3 storage #21801

@arthanson

Description

@arthanson

NetBox Edition

NetBox Community

NetBox Version

v4.5.5

Python Version

3.12

Steps to Reproduce

  1. switch to using S3 storage for image upload
  2. go to site and add an image attachment for a given file and choose "Create and Add Another"
  3. upload the same file again.
  4. check the uploaded image filenames in both image attachment and in Object Change

Expected Behavior

The images should have different filenames, when you do this using local file storage a unique value will be appended onto the filename to make it unique, for example:

site_28_action-buttons.png
site_28_action-buttons_sdmmer4.png

While having these names be the same causes no problem in the UI, the Object Change having the same name will cause issues with branching and is different behavior then when using local storage.

Observed Behavior

The file is uploaded in both places with the same name. Here is the object change records for both files:

name: ""
image: "image-attachments/site_28_action-buttons.png"
object_id: 28
description: ""
image_width: 1698
object_type: 57
image_height: 342
name: ""
image: "image-attachments/site_28_action-buttons.png"
object_id: 28
description: ""
image_width: 1698
object_type: 57
image_height: 342

as can be seen they are duplicated. On local file storage the second image will be:

name: ""
image: "image-attachments/site_28_action-buttons_sdmmer4.png"
object_id: 28
description: ""
image_width: 1698
object_type: 57
image_height: 342

Metadata

Metadata

Assignees

No one assigned

    Labels

    netboxseverity: mediumResults in substantial degraded or broken functionality for specfic workflowsstatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationtype: bugA confirmed report of unexpected behavior in the application

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions