Skip to content

Commit b584f09

Browse files
committed
Fixes #8319: Custom URL fields should honor ALLOWED_URL_SCHEMES config parameter
1 parent d2968c9 commit b584f09

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

docs/release-notes/version-3.1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* [#8306](https://github.com/netbox-community/netbox/issues/8306) - Redirect user to previous page after login
1919
* [#8314](https://github.com/netbox-community/netbox/issues/8314) - Prevent custom fields with default values from appearing as applied filters erroneously
2020
* [#8317](https://github.com/netbox-community/netbox/issues/8317) - Fix CSV import of multi-select custom field values
21+
* [#8319](https://github.com/netbox-community/netbox/issues/8319) - Custom URL fields should honor `ALLOWED_URL_SCHEMES` config parameter
2122

2223
---
2324

netbox/utilities/validators.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ class EnhancedURLValidator(URLValidator):
2020
r'(?::\d{2,5})?' # Port number
2121
r'(?:[/?#][^\s]*)?' # Path
2222
r'\Z', re.IGNORECASE)
23+
schemes = None
2324

24-
def __init__(self, schemes=None, **kwargs):
25-
super().__init__(**kwargs)
26-
if schemes is not None:
25+
def __call__(self, value):
26+
if self.schemes is None:
27+
# We can't load the allowed schemes until the configuration has been initialized
2728
self.schemes = get_config().ALLOWED_URL_SCHEMES
29+
return super().__call__(value)
2830

2931

3032
class ExclusionValidator(BaseValidator):

0 commit comments

Comments
 (0)