From 792bc34d77370a4eed54cf41e7bedb160e085e24 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 24 Mar 2023 13:31:12 +0200 Subject: [PATCH] fix this https://rdrama.net/h/changelog/post/157290/rdramanet-is-proud-to-welcome-the/3852376#context --- files/helpers/sanitize.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 62623741b..d6135d5ee 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -51,7 +51,7 @@ allowed_tags = ('b','blockquote','br','code','del','em','h1','h2','h3','h4','h5' 'li','ol','p','pre','strong','sub','sup','table','tbody','th','thead','td','tr','ul', 'marquee','a','span','ruby','rp','rt','spoiler','img','lite-youtube','video','audio','g') -allowed_styles = ['color', 'background-color', 'font-weight', 'text-align', 'filter',] +allowed_styles = ['color', 'background-color', 'font-weight', 'text-align'] def allowed_attributes(tag, name, value): @@ -473,7 +473,12 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_emojis= sanitized = sanitized.replace('

', '') sanitized = sanitized.replace('','').replace('','') - css_sanitizer = CSSSanitizer(allowed_css_properties=allowed_styles) + if g.v and g.v.agendaposter: + allowed_css_properties = allowed_styles + else: + allowed_css_properties = allowed_styles + ["filter"] + + css_sanitizer = CSSSanitizer(allowed_css_properties=allowed_css_properties) sanitized = bleach.Cleaner(tags=allowed_tags, attributes=allowed_attributes, protocols=['http', 'https'],