Message226462
Maybe for an extended path it could try _getfinalpathname without the prefix. If it isn't a valid path or the result isn't the same as _getfinalpathname including the prefix, then skip calling _ext_to_normal. For example:
def resolve(self, path):
s = str(path)
if not s:
return os.getcwd()
if _getfinalpathname is not None:
prefix, t = self._split_extended_path(s)
s = _getfinalpathname(s)
if prefix:
try:
if _getfinalpathname(t) != s:
return s
except FileNotFoundError:
return s
return self._ext_to_normal(s)
# Means fallback on absolute
return None
The 'foo.' path in this issue would keep the prefix:
>>> Path('//?/C:/foo.').resolve()
WindowsPath('//?/C:/foo.')
>>> Path('//?/UNC/server/C$/foo.').resolve()
WindowsPath('//?/UNC/server/C$/foo.')
But regular paths would remove the prefix:
>>> Path('//?/C:/bar').resolve()
WindowsPath('C:/bar')
>>> Path('//?/UNC/server/C$/bar').resolve()
WindowsPath('//server/C$/bar')
On a related note, _split_extended_path only looks for uppercase "UNC", which makes the above resolve method fail:
>>> Path('//?/unc/server/C$/bar').resolve()
WindowsPath('//?/UNC/server/C$/bar') |
|
Date |
User |
Action |
Args |
2014-09-06 01:23:36 | eryksun | set | recipients:
+ eryksun, pitrou, tim.golden, zach.ware, steve.dower, Kevin.Norris |
2014-09-06 01:23:36 | eryksun | set | messageid: <1409966616.76.0.383883377532.issue22299@psf.upfronthosting.co.za> |
2014-09-06 01:23:36 | eryksun | link | issue22299 messages |
2014-09-06 01:23:35 | eryksun | create | |
|