summaryrefslogtreecommitdiffstats
path: root/Lib/urlparse.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-12-03 22:38:56 (GMT)
committerGuido van Rossum <guido@python.org>1997-12-03 22:38:56 (GMT)
commite612be59263f9771f89c79a89843872ae1b8f667 (patch)
treed4e81c806325fd5f51d3c0a2e7f3cbcd71d09d2c /Lib/urlparse.py
parent3fa440ea9198b1d1549ab8caf9f263d2f06c608f (diff)
downloadcpython-e612be59263f9771f89c79a89843872ae1b8f667.zip
cpython-e612be59263f9771f89c79a89843872ae1b8f667.tar.gz
cpython-e612be59263f9771f89c79a89843872ae1b8f667.tar.bz2
Patch my Marc Lemburg to fix urljoin("/a", "..") and urljoin("/a", "..#1").
Diffstat (limited to 'Lib/urlparse.py')
-rw-r--r--Lib/urlparse.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/urlparse.py b/Lib/urlparse.py
index 22a5fd0..560028d 100644
--- a/Lib/urlparse.py
+++ b/Lib/urlparse.py
@@ -151,7 +151,9 @@ def urljoin(base, url, allow_framents = 1):
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))