>>> 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.
Bug report
For example:
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