aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/forms
diff options
context:
space:
mode:
Diffstat (limited to 'webmentions_ssg/forms')
-rw-r--r--webmentions_ssg/forms/validators.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/webmentions_ssg/forms/validators.py b/webmentions_ssg/forms/validators.py
index 67ab9c0..dd0ee9b 100644
--- a/webmentions_ssg/forms/validators.py
+++ b/webmentions_ssg/forms/validators.py
@@ -85,7 +85,8 @@ class AllowedHostname:
:param field: Field containing the URL to validate.
:raises ValidationError: If the URL hostname is not configured as allowed.
"""
- if urlsplit(field.data).hostname in current_app.config["ALLOWED_HOSTNAMES"]:
+ hostname = urlsplit(field.data).hostname
+ if hostname is not None and hostname in current_app.config["ALLOWED_HOSTNAMES"]:
return
raise ValidationError(self.message or field.gettext("Invalid input."))