Made relative URLs clickable as well.

This commit is contained in:
Alessandro 2022-04-12 23:58:39 +00:00
parent df92e57ad6
commit 299888184a

View File

@ -218,7 +218,7 @@ def format_value(value):
return template.render(context) return template.render(context)
elif isinstance(value, str): elif isinstance(value, str):
if ( 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) re.search(r'\s', value)
): ):
return mark_safe('<a href="{value}">{value}</a>'.format(value=escape(value))) return mark_safe('<a href="{value}">{value}</a>'.format(value=escape(value)))