Bug report
Bug description:
On Windows, urllib.request.url2pathname() mishandles an uncommon file URI variant encoding a UNC path. Specifically, a URI with five leading slashes should be converted to a UNC path with two leading slashes, but url2pathname() returns a path with three leading slashes. Such URIs are created by software that simply prepends file:/// to a Windows path. See RFC 8089 E.3.2, final example.
>>> from urllib.request import url2pathname
>>> url2pathname('/////server/share')
'\\\\\\server\\share' # expected: '\\\\server\\share'
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs
Bug report
Bug description:
On Windows,
urllib.request.url2pathname()mishandles an uncommon file URI variant encoding a UNC path. Specifically, a URI with five leading slashes should be converted to a UNC path with two leading slashes, buturl2pathname()returns a path with three leading slashes. Such URIs are created by software that simply prependsfile:///to a Windows path. See RFC 8089 E.3.2, final example.CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs
url2pathname(): handle extra slash before UNC drive in URL path #127132url2pathname(): handle extra slash before UNC drive in URL path (GH-127132) #127135url2pathname(): handle extra slash before UNC drive in URL path (GH-127132) #127136