-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Unable to add images to a Device Type using a PATCH request #15356
Comments
+1 just hitting this very same issue today |
+1, same same |
Bug reports which reference code outside NetBox core are not actionable. If you believe there is a bug in the REST API, please provide suitable reproduction steps that do not rely on third party code, which someone else can follow to reproduce the suspect behavior. (This may be as simple as posting an example API request.) |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Returns: Reverting 839609d makes the above curl command succede. The rest API also returns the wrong string in front_image/rear_image when the commit is not reverted: Without the bad commit: With the bad commit: Lastly it's immediately obvious from looking at the commit that it's wrong. The two model fields are ImageFields, obviously not URLFields. Not sure how this was not caught by the submitter nor the reviewer, and it seems like the unit tests doesn't catch this either. |
@kkthxbye-code thanks for documenting those very simple reproduction steps. Given that you've already looked into the underlying issue, would you like to submit a PR for this? |
Guess I'll take this one. |
Deployment Type
Self-hosted
NetBox Version
v3.7.3
Python Version
3.8
Steps to Reproduce
NETBOX_URL=<your netbox instance> REPO_URL=https://github.com/netbox-community/devicetype-library/ NETBOX_TOKEN=<your netbox token> python3 nb-dt-import.py
This used to work, I believe this issue related to the change in this commit: 839609d.
It works in v3.7.2.
Expected Behavior
Images should be successfully uploaded and added to the Device Type.
Observed Behavior
Device-Type-Library-Import will get HTTP 400 error from the API when trying to upload images.
Example log message
Images {'front_image': '/Users/username/tmp/Device-Type-Library-Import/repo/elevation-images/Dell/dell-powervault-nx3240.front.png', 'rear_image': '/Users/username/tmp/Device-Type-Library-Import/repo/elevation-images/Dell/dell-powervault-nx3240.rear.png'} updated at https://localhost/api/dcim/device-types/393/: <Response [400]>
Further inspection of the response body shows:
{"front_image":["Enter a valid URL."],"rear_image":["Enter a valid URL."]}
The text was updated successfully, but these errors were encountered: