diff --git a/app/utils.py b/app/utils.py index 2cd16610..4a54b5cf 100644 --- a/app/utils.py +++ b/app/utils.py @@ -191,6 +191,7 @@ def allowlist_html(html: str) -> str: url = False for t in re_url.split(tag.string): if re_url.match(t): + # Avoid picking up trailing punctuation for raw URLs in text href = t[:-1] if t[-1] in ['.', ',', ')', '!', ':', ';', '?'] else t a = soup.new_tag("a", href=href) a.string = href