diff options
author | Facundo Batista <facundobatista@gmail.com> | 2008-08-14 16:51:00 +0000 |
---|---|---|
committer | Facundo Batista <facundobatista@gmail.com> | 2008-08-14 16:51:00 +0000 |
commit | 67d1981c5172e840ac3e2fc3505ce9c3abe5cd63 (patch) | |
tree | ef2d24d280373c3739dcb2ceff0edd07c422f266 /Lib/urlparse.py | |
parent | 8401eec7fab006b65b82a213f3312b96e0ae29e8 (diff) | |
download | cpython-git-67d1981c5172e840ac3e2fc3505ce9c3abe5cd63.tar.gz |
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.
Diffstat (limited to 'Lib/urlparse.py')
-rw-r--r-- | Lib/urlparse.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/urlparse.py b/Lib/urlparse.py index c384db782b..1914304bfb 100644 --- a/Lib/urlparse.py +++ b/Lib/urlparse.py @@ -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] == '.': |