Update validate.py

This commit is contained in:
Joachim 2023-01-01 20:51:23 +01:00
parent ac2ef667af
commit fa3edea87b

View file

@ -4,7 +4,10 @@ from bookwyrm.settings import DOMAIN, USE_HTTPS
def validate_url_domain(url, default="/"): def validate_url_domain(url, default="/"):
"""Basic check that the URL starts with the instance domain name""" """Basic check that the URL starts with the instance domain name"""
if url in ("/", default, None): if not url:
return default
if url in ("/", default):
return url return url
protocol = "https://" if USE_HTTPS else "http://" protocol = "https://" if USE_HTTPS else "http://"