Made relative URLs clickable as well. (#8464)

This commit is contained in:
Alessandro 2022-06-08 23:03:00 +09:00 committed by GitHub
parent 5185cc9348
commit 82475c232b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -218,7 +218,7 @@ def format_value(value):
return template.render(context)
elif isinstance(value, str):
if (
(value.startswith('http:') or value.startswith('https:')) and not
(value.startswith('http:') or value.startswith('https:') or value.startswith('/')) and not
re.search(r'\s', value)
):
return mark_safe('<a href="{value}">{value}</a>'.format(value=escape(value)))