Fix trailing slash handling in pkg_resources.ZipProvider#1232
Merged
Conversation
added 2 commits
December 11, 2017 16:32
Given a ZipProvider, if the underlying ZipImporter prefix is empty,
then resource_listdir('') and resource_listdir('subdir/') fail, while
resource_listdir('/') and resource_listdir('subdir') succeed.
On the other hand, if the underlying ZipImport prefix is not empty,
then resource_listdir('/') fails but resource_listdir('') succeeds.
With this change, the cases listed succeed with or without trailing
slashes.
jaraco
requested changes
Dec 22, 2017
jaraco
left a comment
Member
There was a problem hiding this comment.
Looks good to me. No objections to include. Could you add a changelog entry to CHANGES.txt for a new release with an 0.0.1 bump?
| # Convert a virtual filename (full path to file) into a zipfile subpath | ||
| # usable with the zipimport directory cache for our target archive | ||
| while fspath.endswith(os.sep): | ||
| fspath = fspath[:-1] |
Member
There was a problem hiding this comment.
Could these two lines be fspath = fspath.rstrip(os.sep)?
Author
|
Added changelog entry, bumped version number, and rebased to head. Thanks. |
Member
|
Excellent. With those changes, I can cut the release from my comm. |
This was referenced Feb 2, 2018
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.
Given a ZipProvider, if the underlying ZipImporter prefix is empty,
then resource_listdir('') and resource_listdir('subdir/') fail, while
resource_listdir('/') and resource_listdir('subdir') succeed.
On the other hand, if the underlying ZipImport prefix is not empty,
then resource_listdir('/') fails but resource_listdir('') succeeds.
With this change, the cases listed succeed with or without trailing
slashes.
Fixes #1188