Revert "delete empty <a> tags to prevent exploits"

This reverts commit 5f78b4e365.

This commit is breaking @-mentions in a great many contexts and
I'm not quite sure how to fix it right now.
master
Snakes 2022-06-22 17:59:30 -04:00
parent 36d24cf213
commit 26273d0997
1 changed files with 1 additions and 3 deletions

View File

@ -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"]