mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-01 22:11:16 +00:00
Update validate.py
This commit is contained in:
parent
ac2ef667af
commit
fa3edea87b
1 changed files with 4 additions and 1 deletions
|
@ -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://"
|
||||||
|
|
Loading…
Reference in a new issue