summaryrefslogtreecommitdiffstats
path: root/Lib/dos-8x3/macurl2p.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-05-22 20:48:03 (GMT)
committerGuido van Rossum <guido@python.org>1997-05-22 20:48:03 (GMT)
commitf1e63545483a3b4eb7d8357e8a1ed2cb048bbb00 (patch)
treebb0a99e2f85607bec83bca986256c54cd3f05505 /Lib/dos-8x3/macurl2p.py
parentc2d14176153038d568770f5499c8aa6a8c6a93fc (diff)
downloadcpython-f1e63545483a3b4eb7d8357e8a1ed2cb048bbb00.zip
cpython-f1e63545483a3b4eb7d8357e8a1ed2cb048bbb00.tar.gz
cpython-f1e63545483a3b4eb7d8357e8a1ed2cb048bbb00.tar.bz2
The usual
Diffstat (limited to 'Lib/dos-8x3/macurl2p.py')
-rwxr-xr-xLib/dos-8x3/macurl2p.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/dos-8x3/macurl2p.py b/Lib/dos-8x3/macurl2p.py
index 7d53d62..db4c599 100755
--- a/Lib/dos-8x3/macurl2p.py
+++ b/Lib/dos-8x3/macurl2p.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