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

subtle changes to relative rurl joins

parent 7ec25d00
...@@ -68,6 +68,7 @@ def urlparse(url, scheme = '', allow_framents = 1): ...@@ -68,6 +68,7 @@ def urlparse(url, scheme = '', allow_framents = 1):
# states that these are equivalent). # states that these are equivalent).
def urlunparse((scheme, netloc, url, params, query, fragment)): def urlunparse((scheme, netloc, url, params, query, fragment)):
if netloc: if netloc:
if url[:1] != '/': url = '/' + url
url = '//' + netloc + url url = '//' + netloc + url
if scheme: if scheme:
url = scheme + ':' + url url = scheme + ':' + url
...@@ -118,9 +119,8 @@ def urljoin(base, url, allow_framents = 1): ...@@ -118,9 +119,8 @@ def urljoin(base, url, allow_framents = 1):
return urlunparse((scheme, netloc, path, return urlunparse((scheme, netloc, path,
params, query, fragment)) params, query, fragment))
i = string.rfind(bpath, '/') i = string.rfind(bpath, '/')
if i < 0: if i >= 0:
i = len(bpath) path = bpath[:i] + '/' + path
path = bpath[:i] + '/' + path
segments = string.splitfields(path, '/') segments = string.splitfields(path, '/')
if segments[-1] == '.': if segments[-1] == '.':
segments[-1] = '' segments[-1] = ''
......
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