Repository navigation
Preserve literal percent escapes when opening local file URLs - #6791
Merged
Merged
Conversation
Remove URL decoding from path string before returning.
Add unit tests for file URL path conversions and file opening.
Preserve literal percent escapes in local file paths when converting file URLs.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The issue
Fixes #6790.
url_to_pathcallsurl2pathname, which already decodes percent escapes. Callingunquoteagain changes literal sequences in filenames, such asrequirements%20dev.txtintorequirements dev.txt, soopen_filecannot find the original file.The fix
Remove the second decode and keep platform-specific conversion in
url2pathname. Add 15 tests for path/URL round trips, actual local file opening, spaces/plus/Unicode controls and thePathreturn type. Only project-owned code is changed;vendor/andpatched/are untouched.Validation on Linux with CPython 3.13.18 and 3.14.10:
tests/unit/test_manifest_cache.py::TestCorruptionRobustness::test_expires_at_wrong_type_treated_as_miss. It returns the in-memory cached manifest after the test changes the on-diskexpires_attype. This patch does not change that code. The full unit suite is not all green.git diff --check.No Windows/macOS, integration suite, private package-index server, full-install/CLI resolver or remote CI result is claimed. No broad coverage-threshold pass is claimed.
The checklist
news/6790.bugfix.rst