Bug when editing image #1167

Closed
opened 2025-12-29 16:29:40 +01:00 by adam · 1 comment
Owner

Originally created by @CassioFabius on GitHub (Aug 10, 2017).

Issue type: bug report

Python version: Python 2.7.12
NetBox version: 2.1.2

If a user tries to edit an image, he/she is not able to edit only the name. It's necessary to reupload the image. And when he/she does this, another version of the same image (or a different one) is stored in the server, in order that the old image can only be deleted manually.

Steps taken to reproduce the bug:

  1. Upload an image;

  2. Click "Edit image";

  3. Change the name (or not) and click "Update";

  4. It will be asked to upload a new image;

  5. Select a new image and click "Update" again;

  6. In the server, on "/opt/netbox/netbox/media/image-attachments", there will be two images:
    The old one: Image.jpg
    And the new one: Image_Q0vTcoa.jpg

  7. Delete the image on Netbox;

  8. The old image's still there (/opt/netbox/netbox/media/image-attachments/Image.jpg).

I would like to suggest the possibility to change only the image's name and, when reuploading a new image, it would be necessary to delete the old one automatically.

Originally created by @CassioFabius on GitHub (Aug 10, 2017). **Issue type: bug report** **Python version: Python 2.7.12** **NetBox version: 2.1.2** If a user tries to edit an image, he/she is not able to edit only the name. It's necessary to reupload the image. And when he/she does this, another version of the same image (or a different one) is stored in the server, in order that the old image can only be deleted manually. Steps taken to reproduce the bug: 1) Upload an image; 2) Click "Edit image"; 3) Change the name (or not) and click "Update"; 4) It will be asked to upload a new image; 5) Select a new image and click "Update" again; 6) In the server, on "/opt/netbox/netbox/media/image-attachments", there will be two images: The old one: Image.jpg And the new one: Image_Q0vTcoa.jpg 7) Delete the image on Netbox; 8) The old image's still there (/opt/netbox/netbox/media/image-attachments/Image.jpg). I would like to suggest the possibility to change only the image's name and, when reuploading a new image, it would be necessary to delete the old one automatically.
adam added the type: bug label 2025-12-29 16:29:40 +01:00
adam closed this issue 2025-12-29 16:29:40 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 11, 2017):

There are two issues being discussed here:

  1. Editing an image attachment should not require re-uploading a file
  2. When a file is re-uploaded, the old file should be removed from disk.

I'm only going to address the first point in the fix for this bug. The second point is an intentional behavior in Django and not a simple fix. (I'm not saying we won't alter the behavior but it probably needs more thought.)

@jeremystretch commented on GitHub (Aug 11, 2017): There are two issues being discussed here: 1. Editing an image attachment should not require re-uploading a file 2. When a file is re-uploaded, the old file should be removed from disk. I'm only going to address the first point in the fix for this bug. The second point is an intentional behavior in Django and not a simple fix. (I'm not saying we won't alter the behavior but it probably needs more thought.)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1167