netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.99k stars 2.57k forks source link

Custom Fields Bug #8602

Closed dreamage closed 2 years ago

dreamage commented 2 years ago

NetBox version

v3.1.7

Python version

3.7

Steps to Reproduce

  1. Add a Custom Fields Name: 1111 Content types: DCIM > device

  2. Add a new device

  3. Delete Custom Fields 1111

  4. Edit the device by step 2 and save get a error Unknown field name '1111' in custom field data.

Expected Behavior

edit and save

Observed Behavior

Unknown field name '1111' in custom field data.

jeremystretch commented 2 years ago

This seems to be reproducible only when the custom field name can be confused with an integer. Repeating the above using a name with at least one alphabetic character works as expected and does not trigger an error. My guess is that the field name is being mistaken for an integer at some point.

It's difficult to image a use case for a numeric-only custom field name. This might be best solved by requiring at least one alphabetic character in a custom field name.

dreamage commented 2 years ago

Thank for your replay. How can I fix my dirty devices infomation, I can't edit it from WebUI. Can I edit the postgresql database directly? table: public.dcim_device -- field: custom_field_data from {"1111": "test", "abc": "abc"} change to {"abc": "abc"}

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

github-actions[bot] commented 2 years ago

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.