]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Handling of pathnames pointing to files on toplevel folder of disk was
authorGuido van Rossum <guido@python.org>
Tue, 20 May 1997 16:00:07 +0000 (16:00 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 20 May 1997 16:00:07 +0000 (16:00 +0000)
incorrect (Jack)

Lib/macurl2path.py

index 7d53d624aa7296d1e4cddc643ea4c098e80ad185..db4c599b016171c17e36fdd0106765d549a0e12f 100644 (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