From: Guido van Rossum Date: Tue, 1 Jun 1999 14:36:56 +0000 (+0000) Subject: Jack Jansen's patch to support file:///path/file/name URL syntax. X-Git-Tag: v1.6a1~1317 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=116b31bed74776dd93a0dc4f24f383f7a954796b;p=thirdparty%2FPython%2Fcpython.git Jack Jansen's patch to support file:///path/file/name URL syntax. --- diff --git a/Lib/macurl2path.py b/Lib/macurl2path.py index 7d273bc61064..4c43d2110f54 100644 --- a/Lib/macurl2path.py +++ b/Lib/macurl2path.py @@ -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