Aevann1 2022-07-12 22:30:00 +02:00
parent fb73fa0612
commit dcc63c7834
1 changed files with 6 additions and 0 deletions

View File

@ -228,6 +228,12 @@ def sanitize(sanitized, edit=False):
for tag in soup.find_all("img"): for tag in soup.find_all("img"):
if tag.get("src") and not tag["src"].startswith('/pp/'): if tag.get("src") and not tag["src"].startswith('/pp/'):
if not is_safe_url(tag["src"]):
a = soup.new_tag("a", href=tag["src"], rel="nofollow noopener noreferrer", target="_blank")
a.string = tag["src"]
tag.replace_with(a)
continue
tag["loading"] = "lazy" tag["loading"] = "lazy"
tag["data-src"] = tag["src"] tag["data-src"] = tag["src"]
tag["src"] = "/i/l.webp" tag["src"] = "/i/l.webp"