mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-22 22:34:01 -07:00
Merge b919bd0413
into 195f22f679
This commit is contained in:
commit
2e80b6d5d1
2 changed files with 8 additions and 2 deletions
|
@ -70,6 +70,7 @@ from youtube_dl.utils import (
|
|||
sanitize_filename,
|
||||
sanitize_path,
|
||||
sanitize_url,
|
||||
sanitized_Request,
|
||||
expand_path,
|
||||
prepend_extension,
|
||||
replace_extension,
|
||||
|
@ -250,6 +251,11 @@ class TestUtil(unittest.TestCase):
|
|||
self.assertEqual(sanitize_url('httpss://foo.bar'), 'https://foo.bar')
|
||||
self.assertEqual(sanitize_url('rmtps://foo.bar'), 'rtmps://foo.bar')
|
||||
self.assertEqual(sanitize_url('https://foo.bar'), 'https://foo.bar')
|
||||
self.assertEqual(sanitize_url('ytsearch:search query'), 'ytsearch:search query')
|
||||
|
||||
def test_sanitized_Request(self):
|
||||
# issue 31008
|
||||
self.assertEqual(sanitized_Request('https://foo.bar/foo bar').get_full_url(), 'https://foo.bar/foo%20bar')
|
||||
|
||||
def test_expand_path(self):
|
||||
def env(var):
|
||||
|
|
|
@ -2175,11 +2175,11 @@ def sanitize_url(url):
|
|||
for mistake, fixup in COMMON_TYPOS:
|
||||
if re.match(mistake, url):
|
||||
return re.sub(mistake, fixup, url)
|
||||
return escape_url(url)
|
||||
return url
|
||||
|
||||
|
||||
def sanitized_Request(url, *args, **kwargs):
|
||||
return compat_urllib_request.Request(sanitize_url(url), *args, **kwargs)
|
||||
return compat_urllib_request.Request(escape_url(sanitize_url(url)), *args, **kwargs)
|
||||
|
||||
|
||||
def expand_path(s):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue