8000 Close a few more holes (and make the tests pass again) · awesome-python/html5lib-python@93b4f1c · GitHub
[go: up one dir, main page]

Skip to content

Commit 93b4f1c

Browse files
committed
Close a few more holes (and make the tests pass again)
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40705
1 parent 56e0bed commit 93b4f1c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/sanitizer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class HTMLSanitizer(HTMLTokenizer):
8181
'xmlns:xlink', 'y', 'y1', 'y2', 'zoomAndPan']
8282

8383
attr_val_is_uri = ['href', 'src', 'cite', 'action', 'longdesc',
84-
'xlink:href']
84+
'xlink:href', 'xml:base']
8585

8686
acceptable_css_properties = ['azimuth', 'background-color',
8787
'border-bottom-color', 'border-collapse', 'border-color',
@@ -138,7 +138,7 @@ def __iter__(self):
138138
attrs = dict([(name,val) for name,val in token["data"][::-1] if name in self.allowed_attributes])
139139
for attr in self.attr_val_is_uri:
140140
if not attrs.has_key(attr): continue
141-
val_unescaped = re.sub("[\000-\040\177-\240\s]+", '', unescape(attrs[attr])).lower()
141+
val_unescaped = re.sub("[`\000-\040\177-\240\s]+", '', unescape(attrs[attr])).lower()
142142
if re.match("^[a-z0-9][-+.a-z0-9]*:",val_unescaped) and (val_unescaped.split(':')[0] not in self.allowed_protocols):
143143
del attrs[attr]
144144
if attrs.has_key('style'):
@@ -158,6 +158,8 @@ def __iter__(self):
158158
token["type"] = "Characters"
159159
del token["name"]
160160
yield token
161+
elif token["type"] == "Comment":
162+
pass
161163
else:
162164
yield token
163165

0 commit comments

Comments
 (0)
0