From 68082a88a78534417541d8f69191e153094585dd Mon Sep 17 00:00:00 2001 From: jathanism Date: Sat, 13 Mar 2021 11:39:21 -0800 Subject: [PATCH] Fix use of `URLValidator` to correctly validate `RELEASE_CHECK_URL` --- netbox/netbox/settings.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index e85724d21..7b1788cf1 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -123,13 +123,16 @@ TIME_ZONE = getattr(configuration, 'TIME_ZONE', 'UTC') # Validate update repo URL and timeout if RELEASE_CHECK_URL: - try: - URLValidator(RELEASE_CHECK_URL) - except ValidationError: - raise ImproperlyConfigured( + validator = URLValidator( + message=( "RELEASE_CHECK_URL must be a valid API URL. Example: " "https://api.github.com/repos/netbox-community/netbox" ) + ) + try: + validator(RELEASE_CHECK_URL) + except ValidationError as err: + raise ImproperlyConfigured(str(err)) # Enforce a minimum cache timeout for update checks if RELEASE_CHECK_TIMEOUT < 3600: