From d3de97279d906c68bf82f6a827cd29cc8248e03b Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 30 Nov 2017 17:53:44 +0200 Subject: [PATCH 1/3] Ignore PyCharm IDE metadata --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 6aed95b2..ecd62df3 100644 --- a/.gitignore +++ b/.gitignore @@ -80,3 +80,6 @@ target/ # Generated by parse.py -p stats.prof + +# IDE +.idea From 48fb9e1db4dffcb3b3a801ae80eed8a9676ba749 Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 30 Nov 2017 18:00:54 +0200 Subject: [PATCH 2/3] Passing test for lowercase and failing test for uppercase --- html5lib/tests/test_sanitizer.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/html5lib/tests/test_sanitizer.py b/html5lib/tests/test_sanitizer.py index e19deea8..45046d57 100644 --- a/html5lib/tests/test_sanitizer.py +++ b/html5lib/tests/test_sanitizer.py @@ -113,3 +113,15 @@ def test_sanitizer(): yield (runSanitizerTest, "test_should_allow_uppercase_%s_uris" % protocol, "foo" % (protocol, rest_of_uri), """foo""" % (protocol, rest_of_uri)) + + +def test_lowercase_color_codes_in_style(): + sanitized = sanitize_html("

") + expected = '

' + assert expected == sanitized + + +def test_uppercase_color_codes_in_style(): + sanitized = sanitize_html("

") + expected = '

' + assert expected == sanitized From a5a19007cdd951396bd769f1bac937de99b10f30 Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 30 Nov 2017 18:02:01 +0200 Subject: [PATCH 3/3] Allow uppercase hex chararcters in CSS colour check --- html5lib/filters/sanitizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html5lib/filters/sanitizer.py b/html5lib/filters/sanitizer.py index dc801668..6315a1c5 100644 --- a/html5lib/filters/sanitizer.py +++ b/html5lib/filters/sanitizer.py @@ -855,7 +855,7 @@ def sanitize_css(self, style): 'padding']: for keyword in value.split(): if keyword not in self.allowed_css_keywords and \ - not re.match(r"^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword): # noqa + not re.match(r"^(#[0-9a-fA-F]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword): # noqa break else: clean.append(prop + ': ' + value + ';') pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy