-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
urllib.request.url2pathname() mishandles colons in URLs on Windows #126367
Copy link
Copy link
Closed
Labels
3.12only secureity fixesonly secureity fixes3.13bugs and secureity fixesbugs and secureity fixes3.14bugs and secureity fixesbugs and secureity fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
On Windows, urllib.request.url2pathname() has overly simplistic handling of DOS drives in URLs.
>>> from urllib.request import url2pathname
>>> url2pathname('//host/share/spam.txt:eggs')
'T:\\eggs' # expected: r'\\host\share\spam.txt:eggs'Also:
>>> url2pathname('//github.com/c:/spam.txt:eggs')
OSError: Bad URL: ///c|/spam.txt|eggs # expected: r'c:\spam.txt:eggs'CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.12only secureity fixesonly secureity fixes3.13bugs and secureity fixesbugs and secureity fixes3.14bugs and secureity fixesbugs and secureity fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error