-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strip slash before Windows drive letter in path (#10116)
Functions like urllib.parse.urlsplit() parses a file:// URL created from a non-UNC Windows absolute path with a leading slash in the path component: >>> from pathlib import Path >>> from urllib.parse import urlsplit >>> path = Path("C:/Users/VssAdministrator") >>> parsed = urlsplit(path.as_posix()) >>> parsed.path '/C:/Users/VssAdministrator' This value unfortunately does not play well with path functions like open(), so we performs some additional cleanup to strip that leading slash. This commit also contains some minor cleanup to unify how Windows is detected, and how a file:// URL is fetched.
- Loading branch information
Showing
4 changed files
with
42 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Strip leading slash from a ``file://`` URL built from an path with the Windows | ||
drive notation. This fixes bugs where the ``file://`` URL cannot be correctly | ||
used as requirement, constraint, or index URLs on Windows. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters