1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2026-01-14 10:51:37 +00:00

[utils] js_to_json: Prevent false positives for octals (#15474)

Authored by: doe1080
This commit is contained in:
doe1080
2026-01-04 05:53:16 +09:00
committed by GitHub
parent 0066de5b7e
commit 4d4c7e1c69
2 changed files with 4 additions and 1 deletions

View File

@@ -1280,6 +1280,9 @@ class TestUtil(unittest.TestCase):
on = js_to_json('[new Date("spam"), \'("eggs")\']')
self.assertEqual(json.loads(on), ['spam', '("eggs")'], msg='Date regex should match a single string')
on = js_to_json('[0.077, 7.06, 29.064, 169.0072]')
self.assertEqual(json.loads(on), [0.077, 7.06, 29.064, 169.0072])
def test_js_to_json_malformed(self):
self.assertEqual(js_to_json('42a1'), '42"a1"')
self.assertEqual(js_to_json('42a-1'), '42"a"-1')