Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit70fe97b

Browse files
committed
Fix#188: the sanitizer should sanitize given a bogus data URL.
1 parent428cafa commit70fe97b

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

‎CHANGES.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Change Log
22
----------
33

4+
0.9999.1/1.0b5.1
5+
~~~~~~~~~~~~~~~~
6+
7+
Released on April 30, 2015
8+
9+
* Fix #188: fix the sanitizer to not throw an exception when sanitizing
10+
bogus data URLs.
11+
12+
413
0.9999/1.0b5
514
~~~~~~~~~~~~
615

‎html5lib/sanitizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def allowed_token(self, token, token_type):
215215
m=content_type_rgx.match(uri.path)
216216
ifnotm:
217217
delattrs[attr]
218-
ifm.group('content_type')notinself.allowed_content_types:
218+
elifm.group('content_type')notinself.allowed_content_types:
219219
delattrs[attr]
220220

221221
forattrinself.svg_attr_val_allows_ref:

‎html5lib/tests/test_sanitizer.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ def test_sanitizer():
104104
"""<img src="%s:%s">foo</a>"""% (protocol,rest_of_uri),
105105
toxml)
106106

107+
yield (runSanitizerTest,"test_invalid_data_uri",
108+
"<audio controls=\"\"></audio>",
109+
"<audio controls=\"\" src=\"data:foobar\"></audio>",
110+
toxml)
111+
112+
yield (runSanitizerTest,"test_data_uri_disallowed_type",
113+
"<audio controls=\"\"></audio>",
114+
"<audio controls=\"\" src=\"data:text/html,<html>\"></audio>",
115+
toxml)
116+
107117
forprotocolinsanitizer.HTMLSanitizer.allowed_protocols:
108118
rest_of_uri='//sub.domain.tld/path/object.ext'
109119
ifprotocol=='data':

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp