summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-05-20 16:00:07 (GMT)
committerGuido van Rossum <guido@python.org>1997-05-20 16:00:07 (GMT)
commit32f92caa98eb6d513eb4850d23570c7fbbe61cd4 (patch)
tree7f3e8011e3f7b8b05d99194019e4f04d84455e50 /Lib
parentb24c9ea51491e620f99b813cec1b015c968415bf (diff)
downloadcpython-32f92caa98eb6d513eb4850d23570c7fbbe61cd4.zip
cpython-32f92caa98eb6d513eb4850d23570c7fbbe61cd4.tar.gz
cpython-32f92caa98eb6d513eb4850d23570c7fbbe61cd4.tar.bz2
Handling of pathnames pointing to files on toplevel folder of disk was
incorrect (Jack)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/macurl2path.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/macurl2path.py b/Lib/macurl2path.py
index 7d53d62..db4c599 100644
--- a/Lib/macurl2path.py
+++ b/Lib/macurl2path.py
@@ -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