diff options
author | Barney Gale <barney.gale@gmail.com> | 2024-11-22 04:12:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-22 04:12:50 (GMT) |
commit | 8c98ed846a7d7e50c4cf06f823d94737144dcf6a (patch) | |
tree | ba5e770bbeffb7b320c15219972917a01a58af26 /Lib/nturl2path.py | |
parent | ebf564a1d3e2e81b9846535114e481d6096443d2 (diff) | |
download | cpython-8c98ed846a7d7e50c4cf06f823d94737144dcf6a.zip cpython-8c98ed846a7d7e50c4cf06f823d94737144dcf6a.tar.gz cpython-8c98ed846a7d7e50c4cf06f823d94737144dcf6a.tar.bz2 |
GH-127078: `url2pathname()`: handle extra slash before UNC drive in URL path (#127132)
Decode a file URI like `file://///server/share` as a UNC path like
`\\server\share`. This form of file URI is created by software the simply
prepends `file:///` to any absolute Windows path.
Diffstat (limited to 'Lib/nturl2path.py')
-rw-r--r-- | Lib/nturl2path.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/nturl2path.py b/Lib/nturl2path.py index 3308ee7..66092e4 100644 --- a/Lib/nturl2path.py +++ b/Lib/nturl2path.py @@ -22,6 +22,9 @@ def url2pathname(url): elif url[:12] == '//localhost/': # Skip past 'localhost' authority. url = url[11:] + if url[:3] == '///': + # Skip past extra slash before UNC drive in URL path. + url = url[1:] # Windows itself uses ":" even in URLs. url = url.replace(':', '|') if not '|' in url: |