diff --git a/changedetectionio/api/api_v1.py b/changedetectionio/api/api_v1.py index f81b1d58..b91d7fd2 100644 --- a/changedetectionio/api/api_v1.py +++ b/changedetectionio/api/api_v1.py @@ -209,7 +209,7 @@ class CreateWatch(Resource): json_data = request.get_json() url = json_data['url'].strip() - if not validators.url(json_data['url'].strip()): + if not validators.url(url, simple_host=True): return "Invalid or unsupported URL", 400 if json_data.get('proxy'): diff --git a/changedetectionio/forms.py b/changedetectionio/forms.py index 7199b445..7aa64d96 100644 --- a/changedetectionio/forms.py +++ b/changedetectionio/forms.py @@ -259,7 +259,7 @@ class validateURL(object): import validators try: - validators.url(field.data.strip()) + validators.url(field.data.strip(), simple_host=True) except validators.ValidationFailure: message = field.gettext('\'%s\' is not a valid URL.' % (field.data.strip())) raise ValidationError(message) diff --git a/requirements.txt b/requirements.txt index 9c09aca3..7629d352 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,8 @@ flask~=2.0 inscriptis~=2.2 pytz timeago~=1.0 -validators +validators==0.21.2 + # Set these versions together to avoid a RequestsDependencyWarning # >= 2.26 also adds Brotli support if brotli is installed