1
0
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:
jeremystretch
2022-01-11 15:32:04 -05:00
parent d2968c95df
commit b584f09223
2 changed files with 6 additions and 3 deletions

View File

@ -18,6 +18,7 @@
* [#8306](https://github.com/netbox-community/netbox/issues/8306) - Redirect user to previous page after login * [#8306](https://github.com/netbox-community/netbox/issues/8306) - Redirect user to previous page after login
* [#8314](https://github.com/netbox-community/netbox/issues/8314) - Prevent custom fields with default values from appearing as applied filters erroneously * [#8314](https://github.com/netbox-community/netbox/issues/8314) - Prevent custom fields with default values from appearing as applied filters erroneously
* [#8317](https://github.com/netbox-community/netbox/issues/8317) - Fix CSV import of multi-select custom field values * [#8317](https://github.com/netbox-community/netbox/issues/8317) - Fix CSV import of multi-select custom field values
* [#8319](https://github.com/netbox-community/netbox/issues/8319) - Custom URL fields should honor `ALLOWED_URL_SCHEMES` config parameter
--- ---

View File

@ -20,11 +20,13 @@ class EnhancedURLValidator(URLValidator):
r'(?::\d{2,5})?' # Port number r'(?::\d{2,5})?' # Port number
r'(?:[/?#][^\s]*)?' # Path r'(?:[/?#][^\s]*)?' # Path
r'\Z', re.IGNORECASE) r'\Z', re.IGNORECASE)
schemes = None
def __init__(self, schemes=None, **kwargs): def __call__(self, value):
super().__init__(**kwargs) if self.schemes is None:
if schemes is not None: # We can't load the allowed schemes until the configuration has been initialized
self.schemes = get_config().ALLOWED_URL_SCHEMES self.schemes = get_config().ALLOWED_URL_SCHEMES
return super().__call__(value)
class ExclusionValidator(BaseValidator): class ExclusionValidator(BaseValidator):