Mercurial > cpython-lru_cache-weakref
diff Lib/urlparse.py @ 6737:ab3d7a28e07d legacy-trunk
Patch my Marc Lemburg to fix urljoin("/a", "..") and urljoin("/a", "..#1").
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 03 Dec 1997 22:38:56 +0000 |
| parents | b247297be9a0 |
| children | de4c81c06994 |
line wrap: on
line diff
--- a/Lib/urlparse.py Wed Dec 03 22:34:03 1997 +0000 +++ b/Lib/urlparse.py Wed Dec 03 22:38:56 1997 +0000 @@ -151,7 +151,9 @@ i = i+1 else: break - if len(segments) >= 2 and segments[-1] == '..': + if len(segments) == 2 and segments[1] == '..' and segments[0] == '': + segments[-1] = '' + elif len(segments) >= 2 and segments[-1] == '..': segments[-2:] = [''] return urlunparse((scheme, netloc, joinfields(segments, '/'), params, query, fragment))
