Repository navigation
Accept s3:// URLs in rmdir and in merge sources - #1073
Merged
Merged
Conversation
rmdir passed the unsplit path to DeleteBucket, so "s3://bucket" and "bucket/" failed parameter validation. merge used each source path as CopySource as given, so protocol-prefixed sources pointed at a bucket named "s3:".
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.
Two methods pass a caller's path straight to botocore instead of splitting it first, so they fail for the
s3://...form that every other method accepts.rmdirsends the whole path as the bucket name toDeleteBucket. Since #795 it splits the path to reject keys, but it still uses the unsplit path for the call, so a URL or a trailing slash fails client-side:mergeuses each source path asCopySourceas given, so with URLs S3 is asked to copy from a bucket nameds3::rmdirnow uses the bucket thatsplit_pathalready returns, andmergestrips the protocol from each source the same way_copy_manageddoes for itsCopySource. Paths without a protocol behave as before, including?versionId=suffixes on merge sources.Tests:
test_rmdir_bucket_url(s3://test1_bucketandtest1_bucket/) and the news3://case oftest_mergefail on main with the errors above and pass with this change. Also added a changelog entry.I ran
pytest s3fs/tests/test_s3fs.pyand pre-commit (black, flake8) on the changed files. On my Windows machinetest_content_type_is_not_overridedandtest_get_directory_recursivefail on main too, so they're unrelated.