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

exception when attaching an image to a location #8077

Closed
mcwb opened this issue Dec 15, 2021 · 2 comments
Closed

exception when attaching an image to a location #8077

mcwb opened this issue Dec 15, 2021 · 2 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@mcwb
Copy link

mcwb commented Dec 15, 2021

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

@mcwb mcwb added the type: bug A confirmed report of unexpected behavior in the application label Dec 15, 2021
@mcwb
Copy link
Author

mcwb commented Dec 15, 2021

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

@jeremystretch jeremystretch added the status: accepted This issue has been accepted for implementation label Dec 15, 2021
@jeremystretch jeremystretch self-assigned this Dec 15, 2021
@jeremystretch
Copy link
Member

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants