diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-06-01 18:05:41 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-06-01 20:29:02 +0530 |
commit | bc6b9bcd6554c10aa321cbfe151272e0df1a869b (patch) | |
tree | a41c075eb2f54f48087c201cd3ae5857b60a52ba /test/test_utils.py | |
parent | 6e6390321c3937e26c3f51ee1840d9e97764371f (diff) | |
download | hypervideo-pre-bc6b9bcd6554c10aa321cbfe151272e0df1a869b.tar.lz hypervideo-pre-bc6b9bcd6554c10aa321cbfe151272e0df1a869b.tar.xz hypervideo-pre-bc6b9bcd6554c10aa321cbfe151272e0df1a869b.zip |
[utils] 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 `yt-dlp "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.
Diffstat (limited to 'test/test_utils.py')
-rw-r--r-- | test/test_utils.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index a8666caab..cf541de4a 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -239,6 +239,7 @@ 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('foo bar'), 'foo bar') def test_extract_basic_auth(self): auth_header = lambda url: sanitized_Request(url).get_header('Authorization') |