diff options
author | Elyse <26639800+elyse0@users.noreply.github.com> | 2022-09-03 22:09:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-04 08:39:45 +0530 |
commit | 7657ec7ed6318dd66dd72cc100ba7bc5b911366e (patch) | |
tree | 2d9e78616d6f8d54f582f8d0758237c283a9c65c | |
parent | 07a1250e0e90515ff8142161536f9dafa6eaba1b (diff) | |
download | hypervideo-pre-7657ec7ed6318dd66dd72cc100ba7bc5b911366e.tar.lz hypervideo-pre-7657ec7ed6318dd66dd72cc100ba7bc5b911366e.tar.xz hypervideo-pre-7657ec7ed6318dd66dd72cc100ba7bc5b911366e.zip |
[utils] `base_url`: URL paths can contain `&` (#4841)
Authored by: elyse0
Closes #4187
-rw-r--r-- | test/test_utils.py | 1 | ||||
-rw-r--r-- | yt_dlp/utils.py | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index 67cd966d8..96477c53f 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -566,6 +566,7 @@ class TestUtil(unittest.TestCase): self.assertEqual(base_url('http://foo.de/bar/'), 'http://foo.de/bar/') self.assertEqual(base_url('http://foo.de/bar/baz'), 'http://foo.de/bar/') self.assertEqual(base_url('http://foo.de/bar/baz?x=z/x/c'), 'http://foo.de/bar/') + self.assertEqual(base_url('http://foo.de/bar/baz&x=z&w=y/x/c'), 'http://foo.de/bar/baz&x=z&w=y/x/') def test_urljoin(self): self.assertEqual(urljoin('http://foo.de/', '/a/b/c.txt'), 'http://foo.de/a/b/c.txt') diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 90042aa8b..53939f290 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -2479,7 +2479,7 @@ def url_basename(url): def base_url(url): - return re.match(r'https?://[^?#&]+/', url).group() + return re.match(r'https?://[^?#]+/', url).group() def urljoin(base, path): |