exception when attaching an image to a location #5777

Closed
opened 2025-12-29 19:32:35 +01:00 by adam · 2 comments
Owner

Originally created by @mcwb on GitHub (Dec 15, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.1.1

Python version

3.8

Steps to Reproduce

  1. Create a site, and a location under the site
  2. View the location
  3. Click the 'Attach an image' button on the location view
  4. attach a jpg (or png) with a name 1234 and a filename 1234.jpg (any name will do)
  5. Click Create

Expected Behavior

An image should have been uploaded and viewable from the location view

Observed Behavior

Server Error
There was a problem with your request. Please contact an administrator.

A server error occurred instead. The complete exception is provided below:

<class 'Exception'>

Unexpected type of parent object for ImageAttachment

Python version: 3.8.10
NetBox version: 3.1.1

Note that the file is successfully uploaded to the media directory (/opt/netbox/netbox/media/image-attachments) despite the exception.
Note that any image of any size triggers exception.
Note that exception does not occur if image is uploaded to a site, rack or device type
Note that the exception occurs if image is uploaded to a location, circuit or power panel

Originally created by @mcwb on GitHub (Dec 15, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.1.1 ### Python version 3.8 ### Steps to Reproduce 1. Create a site, and a location under the site 2. View the location 2. Click the 'Attach an image' button on the location view 3. attach a jpg (or png) with a name 1234 and a filename 1234.jpg (any name will do) 4. Click Create ### Expected Behavior An image should have been uploaded and viewable from the location view ### Observed Behavior Server Error There was a problem with your request. Please contact an administrator. A server error occurred instead. The complete exception is provided below: <class 'Exception'> Unexpected type of parent object for ImageAttachment Python version: 3.8.10 NetBox version: 3.1.1 Note that the file is successfully uploaded to the media directory (/opt/netbox/netbox/media/image-attachments) despite the exception. Note that any image of any size triggers exception. Note that exception does not occur if image is uploaded to a site, rack or device type Note that the exception occurs if image is uploaded to a location, circuit or power panel
adam added the type: bugstatus: accepted labels 2025-12-29 19:32:35 +01:00
adam closed this issue 2025-12-29 19:32:35 +01:00
Author
Owner

@mcwb commented on GitHub (Dec 15, 2021):

Is /netbox/extras/api/serializers.py missing serializers on lines 172 - 184 for the location, power panel, and circuit models?

@mcwb commented on GitHub (Dec 15, 2021): Is /netbox/extras/api/serializers.py missing serializers on lines 172 - 184 for the location, power panel, and circuit models?
Author
Owner

@jeremystretch commented on GitHub (Dec 15, 2021):

Is /netbox/extras/api/serializers.py missing serializers on lines 172 - 184 for the location, power panel, and circuit models?

Yep, pretty much. I'm not sure why these were statically mapped; we can replace it with a more dynamic resolution for the parent serializer.

@jeremystretch commented on GitHub (Dec 15, 2021): > Is /netbox/extras/api/serializers.py missing serializers on lines 172 - 184 for the location, power panel, and circuit models? Yep, pretty much. I'm not sure why these were statically mapped; we can replace it with a more dynamic resolution for the parent serializer.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5777