diff --git a/included_dependencies/html5lib/__init__.py b/included_dependencies/html5lib/__init__.py index 92a9293..962536c 100644 --- a/included_dependencies/html5lib/__init__.py +++ b/included_dependencies/html5lib/__init__.py @@ -20,4 +20,6 @@ from .serializer import serialize __all__ = ["HTMLParser", "parse", "parseFragment", "getTreeBuilder", "getTreeWalker", "serialize"] -__version__ = "0.99999" + +# this has to be at the top level, see how setup.py parses this +__version__ = "0.9999999" diff --git a/included_dependencies/html5lib/sanitizer.py b/included_dependencies/html5lib/sanitizer.py index d0202aa..b714e8c 100644 --- a/included_dependencies/html5lib/sanitizer.py +++ b/included_dependencies/html5lib/sanitizer.py @@ -207,8 +207,12 @@ class HTMLSanitizerMixin(object): unescape(attrs[attr])).lower() # remove replacement characters from unescaped characters val_unescaped = val_unescaped.replace("\ufffd", "") - uri = urlparse.urlparse(val_unescaped) - if uri: + try: + uri = urlparse.urlparse(val_unescaped) + except ValueError: + uri = None + del attrs[attr] + if uri and uri.scheme: if uri.scheme not in self.allowed_protocols: del attrs[attr] if uri.scheme == 'data': diff --git a/included_dependencies/html5lib/treewalkers/etree.py b/included_dependencies/html5lib/treewalkers/etree.py index d6e91ef..69840c2 100644 --- a/included_dependencies/html5lib/treewalkers/etree.py +++ b/included_dependencies/html5lib/treewalkers/etree.py @@ -10,7 +10,7 @@ except ImportError: import re -from six import text_type +from six import string_types from . import _base from ..utils import moduleFactoryFactory @@ -58,7 +58,7 @@ def getETreeBuilder(ElementTreeImplementation): return _base.COMMENT, node.text else: - assert type(node.tag) == text_type, type(node.tag) + assert isinstance(node.tag, string_types), type(node.tag) # This is assumed to be an ordinary element match = tag_regexp.match(node.tag) if match: