From: Guido van Rossum Date: Tue, 20 May 1997 16:00:07 +0000 (+0000) Subject: Handling of pathnames pointing to files on toplevel folder of disk was X-Git-Tag: v1.5a3~522 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=32f92caa98eb6d513eb4850d23570c7fbbe61cd4;p=thirdparty%2FPython%2Fcpython.git Handling of pathnames pointing to files on toplevel folder of disk was incorrect (Jack) --- diff --git a/Lib/macurl2path.py b/Lib/macurl2path.py index 7d53d624aa72..db4c599b0161 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