Merge remote-tracking branch 'fix/attr' into Develop

This commit is contained in:
Ozzie Isaacs
2026-05-09 10:20:45 +02:00

View File

@@ -36,7 +36,12 @@ def clean_string(unsafe_text, book_id=0):
if bleach:
allowed_tags = list(ALLOWED_TAGS)
allowed_tags.extend(["p", "span", "div", "pre", "br", "h1", "h2", "h3", "h4", "h5", "h6", "img"])
safe_text = clean_html(unsafe_text, tags=set(allowed_tags))
allowed_attributes = {
"*": ["class", "style"],
"a": ["href", "title", "rel"],
"img": ["src", "alt", "title", "width", "height"],
}
safe_text = clean_html(unsafe_text, tags=set(allowed_tags), attributes=allowed_attributes)
else:
safe_text = clean_html(unsafe_text)
except ParserError as e: