diff --git a/frappe/utils/html_utils.py b/frappe/utils/html_utils.py index b9d0e8dfe2..fa84170330 100644 --- a/frappe/utils/html_utils.py +++ b/frappe/utils/html_utils.py @@ -162,7 +162,13 @@ def sanitize_html(html, linkify=False): + mathml_elements + ["html", "head", "meta", "link", "body", "style", "o:p"] ) - attributes = {"*": acceptable_attributes, "svg": svg_attributes} + + def attributes_filter(tag, name, value): + if name.startswith("data-"): + return True + return name in acceptable_attributes + + attributes = {"*": attributes_filter, "svg": svg_attributes} styles = bleach_allowlist.all_styles strip_comments = False