Handling of pathnames pointing to files on toplevel folder of disk was

incorrect (Jack)
This commit is contained in:
Guido van Rossum 1997-05-20 16:00:07 +00:00
parent b24c9ea514
commit 32f92caa98
1 changed files with 6 additions and 1 deletions

View File

@ -44,8 +44,13 @@ def pathname2url(pathname):
if '/' in pathname:
raise RuntimeError, "Cannot convert pathname containing slashes"
components = string.split(pathname, ':')
# Remove empty first and/or last component
if components[0] == '':
del components[0]
if components[-1] == '':
del components[-1]
# Replace empty string ('::') by .. (will result in '/../' later)
for i in range(1, len(components)):
for i in range(len(components)):
if components[i] == '':
components[i] = '..'
# Truncate names longer than 31 bytes