Commit a0fe6ca6 authored by Guido van Rossum's avatar Guido van Rossum

Patch my Marc Lemburg to fix urljoin("/a", "..") and urljoin("/a", "..#1").

parent 5daf3a72
...@@ -151,7 +151,9 @@ def urljoin(base, url, allow_framents = 1): ...@@ -151,7 +151,9 @@ def urljoin(base, url, allow_framents = 1):
i = i+1 i = i+1
else: else:
break 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:] = [''] segments[-2:] = ['']
return urlunparse((scheme, netloc, joinfields(segments, '/'), return urlunparse((scheme, netloc, joinfields(segments, '/'),
params, query, fragment)) params, query, fragment))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment