]> granicus.if.org Git - python/commitdiff
Jack Jansen's patch to support file:///path/file/name URL syntax.
authorGuido van Rossum <guido@python.org>
Tue, 1 Jun 1999 14:36:56 +0000 (14:36 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 1 Jun 1999 14:36:56 +0000 (14:36 +0000)
Lib/macurl2path.py

index 7d273bc61064b6fa7b419c7b8d811078abcd7c88..4c43d2110f54cd6ad8dd60e3744ba9e1b138cc8e 100644 (file)
@@ -13,6 +13,11 @@ def url2pathname(pathname):
     tp = urllib.splittype(pathname)[0]
     if tp and tp <> 'file':
         raise RuntimeError, 'Cannot convert non-local URL to pathname'
+    # Turn starting /// into /, an empty hostname means current host
+    if pathname[:3] == '///':
+       pathname = pathname[2:]
+    elif pathname[:2] == '//':
+        raise RuntimeError, 'Cannot convert non-local URL to pathname'
     components = string.split(pathname, '/')
     # Remove . and embedded ..
     i = 0