Unverified Commit 95f3f7c2 authored by Yen Chi Hsuan's avatar Yen Chi Hsuan
Browse files

[utils] Fix unescapeHTML for misformed string like "&a"" (#13935)

parent f5469da9
version <unreleased>
Core
* [utils] Fix unescapeHTML for misformed string like "&a&quot;" (#13935)
version 2017.08.18 version 2017.08.18
Core Core
......
...@@ -279,6 +279,7 @@ class TestUtil(unittest.TestCase): ...@@ -279,6 +279,7 @@ class TestUtil(unittest.TestCase):
self.assertEqual(unescapeHTML('&#47;'), '/') self.assertEqual(unescapeHTML('&#47;'), '/')
self.assertEqual(unescapeHTML('&eacute;'), 'é') self.assertEqual(unescapeHTML('&eacute;'), 'é')
self.assertEqual(unescapeHTML('&#2013266066;'), '&#2013266066;') self.assertEqual(unescapeHTML('&#2013266066;'), '&#2013266066;')
self.assertEqual(unescapeHTML('&a&quot;'), '&a"')
# HTML5 entities # HTML5 entities
self.assertEqual(unescapeHTML('&period;&apos;'), '.\'') self.assertEqual(unescapeHTML('&period;&apos;'), '.\'')
......
...@@ -596,7 +596,7 @@ def unescapeHTML(s): ...@@ -596,7 +596,7 @@ def unescapeHTML(s):
assert type(s) == compat_str assert type(s) == compat_str
return re.sub( return re.sub(
r'&([^;]+;)', lambda m: _htmlentity_transform(m.group(1)), s) r'&([^&;]+;)', lambda m: _htmlentity_transform(m.group(1)), s)
def get_subprocess_encoding(): def get_subprocess_encoding():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment