mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] GH-137059: url2pathname(): fix support for drive letter in netloc (GH-137060) (#137144)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
This commit is contained in:
parent
fbc2a0ca9a
commit
aeb55ebb07
3 changed files with 11 additions and 1 deletions
|
|
@ -1660,7 +1660,10 @@ def url2pathname(url, *, require_scheme=False, resolve_host=False):
|
|||
if scheme != 'file':
|
||||
raise URLError("URL is missing a 'file:' scheme")
|
||||
if os.name == 'nt':
|
||||
if not _is_local_authority(authority, resolve_host):
|
||||
if authority[1:2] == ':':
|
||||
# e.g. file://c:/file.txt
|
||||
url = authority + url
|
||||
elif not _is_local_authority(authority, resolve_host):
|
||||
# e.g. file://server/share/file.txt
|
||||
url = '//' + authority + url
|
||||
elif url[:3] == '///':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue