[PR #20625] [MERGED] Fixes #20498: Apply validation regex to URL custom fields #15986

Closed
opened 2025-12-30 00:25:10 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20625
Author: @jnovinger
Created: 10/20/2025
Status: Merged
Merged: 10/20/2025
Merged by: @bctiemann

Base: mainHead: 20498-url-custom-field-validation-regex


📝 Commits (1)

  • 6747c82 Fixes #20498: Apply validation regex to URL custom fields

📊 Changes

2 files changed (+38 additions, -0 deletions)

View changed files

📝 netbox/extras/models/customfields.py (+16 -0)
📝 netbox/extras/tests/test_customfields.py (+22 -0)

📄 Description

Fixes: #20498

The validation_regex field was not being enforced for URL type custom fields. This fix adds regex validation in two places:

  1. to_form_field() - Applies regex validator to form fields (UI validation)
  2. validate() - Applies regex check in model validation (API/programmatic)

The original issue reported UI validation only, but this fix also adds API validation for consistency with text field behavior and to ensure data integrity across all entry points.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/20625 **Author:** [@jnovinger](https://github.com/jnovinger) **Created:** 10/20/2025 **Status:** ✅ Merged **Merged:** 10/20/2025 **Merged by:** [@bctiemann](https://github.com/bctiemann) **Base:** `main` ← **Head:** `20498-url-custom-field-validation-regex` --- ### 📝 Commits (1) - [`6747c82`](https://github.com/netbox-community/netbox/commit/6747c82a1a2fe898acbced01531955cf0e2963d5) Fixes #20498: Apply validation regex to URL custom fields ### 📊 Changes **2 files changed** (+38 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/models/customfields.py` (+16 -0) 📝 `netbox/extras/tests/test_customfields.py` (+22 -0) </details> ### 📄 Description Fixes: #20498 The `validation_regex` field was not being enforced for URL type custom fields. This fix adds regex validation in two places: 1. `to_form_field()` - Applies regex validator to form fields (UI validation) 2. `validate()` - Applies regex check in model validation (API/programmatic) The original issue reported UI validation only, but this fix also adds API validation for consistency with text field behavior and to ensure data integrity across all entry points. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:25:10 +01:00
adam closed this issue 2025-12-30 00:25:11 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15986