Aevann 2023-10-07 22:15:28 +03:00
parent 8062b33140
commit 2b8c076249
1 changed files with 3 additions and 3 deletions

View File

@ -456,6 +456,9 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis
soup = BeautifulSoup(sanitized, 'lxml')
if len(soup.select('[bounce], [cide]')) > 5:
error("Max 5 'bounce' and 'cide'!")
for tag in soup.find_all("img"):
if tag.get("src") and not tag["src"].startswith('/pp/') and not (snappy and tag["src"].startswith(f'{SITE_FULL_IMAGES}/e/')):
if not is_safe_url(tag["src"]):
@ -648,9 +651,6 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis
if sanitized.count("blur(") + sanitized.count("drop-shadow(") > 5:
error("Too many filters!")
if sanitized.count("bounce") + sanitized.count("cide") > 5:
error("Too many 'bounce' and 'cide'!")
return sanitized.strip()
def allowed_attributes_emojis(tag, name, value):