mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-20 13:24:16 -07:00
Escape URLs in sanitized_Request
, not sanitize_url
d2558234cf5dd12d6896eed5427b7dcdb3ab7b5a added escaping of URLs while sanitizing. However, sanitize_url
may not always receive an actual URL. Eg: When using youtube-dl "search query" --default-search ytsearch
, search query
gets escaped to search%20query
before being prefixed with ytsearch:
which is not the intended behavior. So the escaping is moved to sanitized_Request
instead.
This commit is contained in:
parent
6067451e43
commit
1d3751c3fe
3 changed files with 22 additions and 2 deletions
|
@ -2176,11 +2176,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