Fixes #21064: Ensures that extra choices preserve nested colons #657

Closed
opened 2026-04-05 17:03:12 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @jnovinger on 1/5/2026

Fixes: #21064

PR #14469 changed the separator from comma to colon. During review, Jeremy requested escape support, noting that colons would need escaping unlike commas. PR #14470 added the escape/unescape logic using the (?<!\\): regex pattern two days later. However, PR #18631 rewrote the __init__ method to fix #17796 (an IndexError when using "Create & Add Another") and inadvertently removed the re-escaping logic, leaving only the parsing side intact.

The fix is to re-escape colons in both value and label before joining them, ensuring proper round-trip handling when editing existing choice sets.

*Originally created by @jnovinger on 1/5/2026* ### Fixes: #21064 PR #14469 changed the separator from comma to colon. During review, Jeremy requested escape support, noting that colons would need escaping unlike commas. PR #14470 added the escape/unescape logic using the `(?<!\\):` regex pattern two days later. However, PR #18631 rewrote the `__init__` method to fix #17796 (an `IndexError` when using "Create & Add Another") and inadvertently removed the re-escaping logic, leaving only the parsing side intact. The fix is to re-escape colons in both value and label before joining them, ensuring proper round-trip handling when editing existing choice sets.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#657