Closed
Description
Bug report
For example:
>>> from urllib.request import pathname2url
>>> 'file:' + pathname2url('//foo/bar')
'file://foo/bar'
This is a file URI with path "/bar" and authority "foo". Non-empty authority other than "localhost" are usually rejected. The right URI for path "//foo/bar" is "file:////foo/bar" -- an URI with explicit empty authority.
Similar bug in urlunparse() and urlunsplit() was fixed in #67693.
Linked PRs
- gh-127217: Fix pathname2url() for paths starting with multiple slashes on Posix #127218
- [3.13] gh-127217: Fix pathname2url() for paths starting with multiple slashes on Posix (GH-127218) #127230
- [3.12] gh-127217: Fix pathname2url() for paths starting with multiple slashes on Posix (GH-127218) #127231