subtle changes to relative rurl joins

This commit is contained in:
Guido van Rossum 1995-08-04 04:29:32 +00:00
parent bbb0a05972
commit fb1a0cd74f
1 changed files with 3 additions and 3 deletions

View File

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