Fixes for URL generation

This commit is contained in:
Oliver Walters 2021-02-16 17:16:36 +11:00
parent fdca3d842d
commit b09e9c0781

View File

@ -74,9 +74,12 @@ def internal_link(link, text):
if not base_url:
return text
url = f"{base_url}/{link}/"
if not base_url.endswith('/'):
base_url += '/'
# Remove any double quotes
url = url.replace("//", "/")
if base_url.endswith('/') and link.startswith('/'):
link = link[1:]
url = f"{base_url}{link}"
return mark_safe(f'<a href="{url}">{text}</a>')