mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
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.
This commit is contained in:
parent
223d3dc554
commit
dbb6e22cb1
3 changed files with 78 additions and 2 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue