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

Commitc0a6375

Browse files
committed
Fix#189: fix the sanitizer to allow relative URLs again.
We regressed this when we added support for data URLs. Oops.
1 parent9e91591 commitc0a6375

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-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.999999/1.0b7
5+
~~~~~~~~~~~~~~
6+
7+
Released on July 7, 2015
8+
9+
* Fix #189: fix the sanitizer to allow relative URLs again (as it did
10+
prior to 0.9999/1.0b5).
11+
12+
413
0.99999/1.0b6
514
~~~~~~~~~~~~~
615

‎html5lib/sanitizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def allowed_token(self, token, token_type):
208208
# remove replacement characters from unescaped characters
209209
val_unescaped=val_unescaped.replace("\ufffd","")
210210
uri=urlparse.urlparse(val_unescaped)
211-
ifuri:
211+
ifurianduri.scheme:
212212
ifuri.schemenotinself.allowed_protocols:
213213
delattrs[attr]
214214
ifuri.scheme=='data':

‎html5lib/tests/test_sanitizer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def test_should_handle_astral_plane_characters():
4040
assert'<html:p xmlns:html="http://www.w3.org/1999/xhtml">\U0001d4b5\U0001d538</html:p>'==sanitize_html("<p>&#x1d4b5; &#x1d538;</p>")
4141

4242

43+
deftest_should_allow_relative_uris():
44+
assert'<html:p xmlns:html="http://www.w3.org/1999/xhtml"><html:a href="/example.com" /></html:p>'==sanitize_html('<p><a href="/example.com"></a></p>')
45+
46+
4347
deftest_sanitizer():
4448
toxml=toxmlFactory()
4549
fortag_nameinsanitizer.HTMLSanitizer.allowed_elements:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp