forked from rDrama/rDrama
delete empty <a> tags to prevent exploits
parent
b8321fd18d
commit
5f78b4e365
|
@ -227,7 +227,9 @@ def sanitize(sanitized, alert=False, edit=False):
|
||||||
tag['referrerpolicy'] = "no-referrer"
|
tag['referrerpolicy'] = "no-referrer"
|
||||||
|
|
||||||
for tag in soup.find_all("a"):
|
for tag in soup.find_all("a"):
|
||||||
if tag.get("href") and fishylinks_regex.fullmatch(str(tag.string)):
|
if not tag.string or not tag.get("href"):
|
||||||
|
tag.decompose()
|
||||||
|
elif fishylinks_regex.fullmatch(str(tag.string)):
|
||||||
tag.string = tag["href"]
|
tag.string = tag["href"]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue