diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2024-11-07 07:09:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-07 07:09:59 (GMT) |
commit | dbb6e22cb1f533bba00a61a5b63ec68af9d48836 (patch) | |
tree | 57acd185257e6b8f9c0b5d3c34f9e51910ad51fe /Lib/urllib | |
parent | 223d3dc554dde45f185f7f465753824c6f698b9b (diff) | |
download | cpython-dbb6e22cb1f533bba00a61a5b63ec68af9d48836.zip cpython-dbb6e22cb1f533bba00a61a5b63ec68af9d48836.tar.gz cpython-dbb6e22cb1f533bba00a61a5b63ec68af9d48836.tar.bz2 |
gh-125926: Fix urllib.parse.urljoin() for base URI with undefined authority (GH-125989)
Although this goes beyond the application of RFC 3986, urljoin()
should support relative base URIs for backward compatibility.
Diffstat (limited to 'Lib/urllib')
-rw-r--r-- | Lib/urllib/parse.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index 5b00ab2..a721d77 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -577,9 +577,9 @@ def urljoin(base, url, allow_fragments=True): if scheme is None: scheme = bscheme - if scheme != bscheme or scheme not in uses_relative: + if scheme != bscheme or (scheme and scheme not in uses_relative): return _coerce_result(url) - if scheme in uses_netloc: + if not scheme or scheme in uses_netloc: if netloc: return _coerce_result(_urlunsplit(scheme, netloc, path, query, fragment)) |