You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File URIs that start with 3+ slashes should be parsed as having an empty authority section (ref), but urllib.request.url2pathname() incorrectly retains the slashes introducing the authority section. This means it can't properly parse the most common form of POSIX absolute file URIs (e.g. file:///etc/hosts).
On Windows, url2pathname() correctly discards slashes before DOS drives (so file:///c:/foo is parsed as c:\foo), and before old-fashioned UNC URIs (so file:////server/share is parsed as \\server\share), but incorrectly retains slashes if a rooted, driveless path is decoded (so file:///foo/bar is decoded as \\\foo\bar instead of \foo\bar). This is much less of a problem because such paths are rare on Windows.
Activity
pythonGH-126766: `url2pathname()`: handle empty authority section.
GH-126766: `url2pathname()`: handle empty authority section. (#126767)
pythonGH-126766: `url2pathname()`: handle empty authority section. (p…
pythonGH-126766: `url2pathname()`: handle empty authority section. (p…
[3.13] GH-126766: `url2pathname()`: handle empty authority section. (G…
[3.12] GH-126766: `url2pathname()`: handle empty authority section. (G…
barneygale commentedon Nov 22, 2024
Re-opening: we should handle 'localhost' authorities in exactly the same way.
pythonGH-126766: `url2pathname()`: handle 'localhost' authority
GH-126766: `url2pathname()`: handle 'localhost' authority (#127129)
pythonGH-126766: `url2pathname()`: handle 'localhost' authority (pyth…
pythonGH-126766: `url2pathname()`: handle 'localhost' authority (pyth…
[3.13] GH-126766: `url2pathname()`: handle 'localhost' authority (GH-…
[3.12] GH-126766: `url2pathname()`: handle 'localhost' authority (GH-…
pythonGH-126766: `url2pathname()`: handle empty authority section. (p…
pythonGH-126766: `url2pathname()`: handle empty authority section. (p…
pythonGH-126766: `url2pathname()`: handle 'localhost' authority (pyth…