Correction urlize

Quand les liens sont collé à du texte

Fix #146
This commit is contained in:
Jean-Marie Favreau 2024-09-15 19:23:24 +02:00
parent 25dbf0c1ad
commit 9961b92913
2 changed files with 5 additions and 1 deletions

View File

@ -26,7 +26,7 @@
</article>
{% endif %}
<p>{{ event.description |linebreaks | urlize }}</p>
<p>{{ event.description |linebreaks | robust_urlize }}</p>
<footer class="infos-and-buttons">
<div class="infos">

View File

@ -135,3 +135,7 @@ def add_url_category(url, c):
return "category=" + str(c.pk)
else:
return url + "&category=" + str(c.pk)
@register.filter
def robust_urlize(txt):
return mark_safe(urlize(mark_safe(txt.replace("http", " http"))).replace(" <a ", "<a "))