From 26273d09970a826f91b98ad66b08bd0c3249678e Mon Sep 17 00:00:00 2001 From: TLSM Date: Wed, 22 Jun 2022 17:59:30 -0400 Subject: [PATCH] Revert "delete empty tags to prevent exploits" This reverts commit 5f78b4e36581acb890c382b783d90e58a940c47c. This commit is breaking @-mentions in a great many contexts and I'm not quite sure how to fix it right now. --- files/helpers/sanitize.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 5b3a109782..8649e990bd 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -227,9 +227,7 @@ def sanitize(sanitized, alert=False, edit=False): tag['referrerpolicy'] = "no-referrer" for tag in soup.find_all("a"): - if not tag.string or not tag.get("href"): - tag.decompose() - elif fishylinks_regex.fullmatch(str(tag.string)): + if tag.get("href") and fishylinks_regex.fullmatch(str(tag.string)): tag.string = tag["href"]