From 0c8e1b4f8921fbcf5b9bc72b44074c65c7bc2d24 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Mon, 28 Jul 2025 10:53:38 -0400 Subject: [PATCH] Allow style attribute on img tags to override CSS width - Added style attribute to bleach allowlist for img tags - Fixes issue where CSS img { width: 100%; } overrides width attribute - Inline style='width:360px;' has higher specificity than stylesheet - Now supports both width='360' and style='width:360px;' formats --- make_post_sell/lib/sanitize_html.py | 1 + 1 file changed, 1 insertion(+) diff --git a/make_post_sell/lib/sanitize_html.py b/make_post_sell/lib/sanitize_html.py index d2a5c6a..71b6792 100644 --- a/make_post_sell/lib/sanitize_html.py +++ b/make_post_sell/lib/sanitize_html.py @@ -56,6 +56,7 @@ def default_cleaner(tag_acl=None): attrs = markdown_attrs attrs["img"].append("width") + attrs["img"].append("style") attrs["span"] = ["class"] # Allow both whitelist and blacklist tag_name/attr/attr_value