mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-10-31 22:55:26 +00:00
[utils] Fix unescapeHTML for misformed string like "&a"" (#13935)
This commit is contained in:
parent
f5469da9e6
commit
95f3f7c20a
3 changed files with 8 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
version <unreleased>
|
||||||
|
|
||||||
|
Core
|
||||||
|
* [utils] Fix unescapeHTML for misformed string like "&a"" (#13935)
|
||||||
|
|
||||||
|
|
||||||
version 2017.08.18
|
version 2017.08.18
|
||||||
|
|
||||||
Core
|
Core
|
||||||
|
|
|
@ -279,6 +279,7 @@ class TestUtil(unittest.TestCase):
|
||||||
self.assertEqual(unescapeHTML('/'), '/')
|
self.assertEqual(unescapeHTML('/'), '/')
|
||||||
self.assertEqual(unescapeHTML('é'), 'é')
|
self.assertEqual(unescapeHTML('é'), 'é')
|
||||||
self.assertEqual(unescapeHTML('�'), '�')
|
self.assertEqual(unescapeHTML('�'), '�')
|
||||||
|
self.assertEqual(unescapeHTML('&a"'), '&a"')
|
||||||
# HTML5 entities
|
# HTML5 entities
|
||||||
self.assertEqual(unescapeHTML('.''), '.\'')
|
self.assertEqual(unescapeHTML('.''), '.\'')
|
||||||
|
|
||||||
|
|
|
@ -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():
|
||||||
|
|
Loading…
Reference in a new issue