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

Surrounding quotes of JSON custom field's simple string default value lost when editing device #15896

Closed
drustan opened this issue Apr 30, 2024 · 3 comments · Fixed by #15903
Closed
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@drustan
Copy link

drustan commented Apr 30, 2024

Deployment Type

Self-hosted

NetBox Version

v3.7.6

Python Version

3.11

Steps to Reproduce

  • Add a custom field of type JSON (extras/custom-fields/add/)
    In the form use DCIM > Device as Content types, testing as name, JSON as type and "testing" (with the double quotes) as default value. Leave all the rest as it is and click create.
  • Navigate to a device page.
  • Click to edit the device.
  • Try to save without changing anything. An Error Enter a valid JSON will show up (the surrounding quotes of the JSON custom fields values are lost, you can't save unless adding the quotes around the value testing in the JSON custom fields)

Expected Behavior

When editing a device, surrounding quotes of JSON custom field values should be kept.

Observed Behavior

Surrounding quotes of already defined JSON custom field values are lost when editing a device.

@drustan drustan added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Apr 30, 2024
@jeffgdotorg
Copy link
Contributor

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.7.6 in my lab. Please re-confirm the reported behavior and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. The demo system's database has been through a lot and may be a factor in what you're experiencing, which is why the bug report template explicitly states that the demo system should not be relied on when reporting bugs.

@jeffgdotorg jeffgdotorg removed their assignment Apr 30, 2024
@jeffgdotorg jeffgdotorg added status: revisions needed This issue requires additional information to be actionable and removed status: needs triage This issue is awaiting triage by a maintainer labels Apr 30, 2024
@drustan
Copy link
Author

drustan commented Apr 30, 2024

Hi, and thank you for your quick response. I've just updated the steps to reproduce the error. Forget about the demo instance then; I thought it would be easier since we both have access to it—sorry about that. The bug actually appeared recently; it was not present in version 3.5.X. Can you reproduce the bug now?

@jeffgdotorg
Copy link
Contributor

Okay, the clarified steps got me there, thanks.

This problem seems to happen only when the field's default value is exactly a quoted string. If the default value is a list or associative array, the problem does not occur for me in 3.7.6.

I'm updating the summary and moving to needs owner.

@jeffgdotorg jeffgdotorg added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: revisions needed This issue requires additional information to be actionable labels Apr 30, 2024
@jeffgdotorg jeffgdotorg changed the title Surrounding quotes of already defined JSON custom field are lost when editing a device Surrounding quotes of JSON custom field's simple string default value lost when editing device Apr 30, 2024
@jeremystretch jeremystretch self-assigned this Apr 30, 2024
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Apr 30, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants