Skip to content

Commit e612be5

Browse files
committed
Patch my Marc Lemburg to fix urljoin("/a", "..") and urljoin("/a", "..#1").
1 parent 3fa440e commit e612be5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/urlparse.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ def urljoin(base, url, allow_framents = 1):
151151
i = i+1
152152
else:
153153
break
154-
if len(segments) >= 2 and segments[-1] == '..':
154+
if len(segments) == 2 and segments[1] == '..' and segments[0] == '':
155+
segments[-1] = ''
156+
elif len(segments) >= 2 and segments[-1] == '..':
155157
segments[-2:] = ['']
156158
return urlunparse((scheme, netloc, joinfields(segments, '/'),
157159
params, query, fragment))

0 commit comments

Comments
 (0)