mirror of
https://github.com/python/cpython.git
synced 2025-07-28 13:44:43 +00:00
Issue 1432. Fixes a bug caused because of the evolution
of the RFC that describes the behaviour. Note that we now have the same behaviour than the current browsers.
This commit is contained in:
parent
8401eec7fa
commit
67d1981c51
2 changed files with 21 additions and 5 deletions
|
@ -217,9 +217,18 @@ def urljoin(base, url, allow_fragments=True):
|
|||
if path[:1] == '/':
|
||||
return urlunparse((scheme, netloc, path,
|
||||
params, query, fragment))
|
||||
if not (path or params or query):
|
||||
return urlunparse((scheme, netloc, bpath,
|
||||
bparams, bquery, fragment))
|
||||
if not path:
|
||||
path = bpath
|
||||
if not params:
|
||||
params = bparams
|
||||
else:
|
||||
path = path[:-1]
|
||||
return urlunparse((scheme, netloc, path,
|
||||
params, query, fragment))
|
||||
if not query:
|
||||
query = bquery
|
||||
return urlunparse((scheme, netloc, path,
|
||||
params, query, fragment))
|
||||
segments = bpath.split('/')[:-1] + path.split('/')
|
||||
# XXX The stuff below is bogus in various ways...
|
||||
if segments[-1] == '.':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue