From 2af319bb23f1e1b2f199a1d16eed4c2ed455701e Mon Sep 17 00:00:00 2001 From: Alex Leach Date: Mon, 17 Nov 2025 21:55:44 +0000 Subject: [PATCH] chore: bleach-nh3. Convert lists to sets (again; fighting against pre-commit making indent changes that obscured 'rel' from acceptable_attributes) --- frappe/utils/html_utils.py | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/frappe/utils/html_utils.py b/frappe/utils/html_utils.py index ef555825b7..cc7ac6cabc 100644 --- a/frappe/utils/html_utils.py +++ b/frappe/utils/html_utils.py @@ -207,7 +207,7 @@ def unescape_html(value): # adapted from https://raw.githubusercontent.com/html5lib/html5lib-python/4aa79f113e7486c7ec5d15a6e1777bfe546d3259/html5lib/sanitizer.py -acceptable_elements = [ +acceptable_elements = { "a", "abbr", "acronym", @@ -309,9 +309,9 @@ acceptable_elements = [ "ul", "var", "video", -] +} -mathml_elements = [ +mathml_elements = { "maction", "math", "merror", @@ -339,9 +339,9 @@ mathml_elements = [ "munder", "munderover", "none", -] +} -svg_elements = [ +svg_elements = { "a", "animate", "animateColor", @@ -377,9 +377,9 @@ svg_elements = [ "title", "tspan", "use", -] +} -acceptable_attributes = [ +acceptable_attributes = { "abbr", "accept", "accept-charset", @@ -540,16 +540,13 @@ acceptable_attributes = [ "itemtype", "itemid", "itemref", - "datetime", "data-is-group", -] +} -mathml_attributes = [ +mathml_attributes = { "actiontype", "align", "columnalign", - "columnalign", - "columnalign", "columnlines", "columnspacing", "columnspan", @@ -568,13 +565,10 @@ mathml_attributes = [ "mathbackground", "mathcolor", "mathvariant", - "mathvariant", "maxsize", "minsize", "other", "rowalign", - "rowalign", - "rowalign", "rowlines", "rowspacing", "rowspan", @@ -584,15 +578,14 @@ mathml_attributes = [ "separator", "stretchy", "width", - "width", "xlink:href", "xlink:show", "xlink:type", "xmlns", "xmlns:xlink", -] +} -svg_attributes = [ +svg_attributes = { "accent-height", "accumulate", "additive", @@ -735,4 +728,4 @@ svg_attributes = [ "y1", "y2", "zoomAndPan", -] +}