1
1
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-12-27 21:15:49 +01:00

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

This commit is contained in:
Yen Chi Hsuan 2017-08-19 21:40:53 +08:00
parent f5469da9e6
commit 95f3f7c20a
No known key found for this signature in database
GPG Key ID: 3FDDD575826C5C30
3 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,9 @@
version <unreleased>
Core
* [utils] Fix unescapeHTML for misformed string like "&a&quot;" (#13935)
version 2017.08.18
Core

View File

@ -279,6 +279,7 @@ class TestUtil(unittest.TestCase):
self.assertEqual(unescapeHTML('&#47;'), '/')
self.assertEqual(unescapeHTML('&eacute;'), 'é')
self.assertEqual(unescapeHTML('&#2013266066;'), '&#2013266066;')
self.assertEqual(unescapeHTML('&a&quot;'), '&a"')
# HTML5 entities
self.assertEqual(unescapeHTML('&period;&apos;'), '.\'')

View File

@ -596,7 +596,7 @@ def unescapeHTML(s):
assert type(s) == compat_str
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():