This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ikelos
Recipients barneygale, eryksun, ikelos
Date 2022-02-06.01:31:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1644111118.22.0.42501864219.issue46654@roundup.psfhosted.org>
In-reply-to
Content
I can confirm that url2pathname work with either number of slashes, and that open_file appears to have had the file: removed.

However, in even if the check in open_file were bypassed, it calls open_local_file, which then strips any host before calling url2pathname, meaning the host will never be included if only two slashes are used.

        host, file = _splithost(url)
        localname = url2pathname(file)

This is what seems to cause the issue when attempting to open file://server/host/file.ext on windows, even though file:////server/host/file.ext open just fine.

The problem that I found, and was in bug #32442, is that pathlib only ever returns two slashes, which despite being a valid and correctly formed url, can't be opened by urllib.request.urlopen().  Since there doesn't seem to be an issue with opening these files (given it works for file:////server...) and since nt2pathname will produce the correct result, it feels as though open_file should have special code on windows to allow servers to be accepted by the file handler (open_local_file should probably stay as is to not change the API too much).
History
Date User Action Args
2022-02-06 01:31:58ikelossetrecipients: + ikelos, eryksun, barneygale
2022-02-06 01:31:58ikelossetmessageid: <1644111118.22.0.42501864219.issue46654@roundup.psfhosted.org>
2022-02-06 01:31:58ikeloslinkissue46654 messages
2022-02-06 01:31:58ikeloscreate