mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #8319: Custom URL fields should honor ALLOWED_URL_SCHEMES config parameter
This commit is contained in:
@ -20,11 +20,13 @@ class EnhancedURLValidator(URLValidator):
|
||||
r'(?::\d{2,5})?' # Port number
|
||||
r'(?:[/?#][^\s]*)?' # Path
|
||||
r'\Z', re.IGNORECASE)
|
||||
schemes = None
|
||||
|
||||
def __init__(self, schemes=None, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
if schemes is not None:
|
||||
def __call__(self, value):
|
||||
if self.schemes is None:
|
||||
# We can't load the allowed schemes until the configuration has been initialized
|
||||
self.schemes = get_config().ALLOWED_URL_SCHEMES
|
||||
return super().__call__(value)
|
||||
|
||||
|
||||
class ExclusionValidator(BaseValidator):
|
||||
|
Reference in New Issue
Block a user