]> granicus.if.org Git - python/commitdiff
Patch my Marc Lemburg to fix urljoin("/a", "..") and urljoin("/a", "..#1").
authorGuido van Rossum <guido@python.org>
Wed, 3 Dec 1997 22:38:56 +0000 (22:38 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 3 Dec 1997 22:38:56 +0000 (22:38 +0000)
Lib/urlparse.py

index 22a5fd0e901d4094a9319108529106f1f57f027f..560028df94c45d071c5595ae600274eb456e78f6 100644 (file)
@@ -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))