Skip to content

Accept s3:// URLs in rmdir and in merge sources - #1073

Merged
martindurant merged 2 commits into
fsspec:mainfrom
raams95:rmdir-merge-protocol
Nov 25, 2026
Merged

martindurant merged 2 commits into
fsspec:mainfrom
raams95:rmdir-merge-protocol

Conversation

@raams95

@raams95 raams95 commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

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.

rmdir sends the whole path as the bucket name to DeleteBucket. 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:

fs.mkdir("my-bucket")
fs.rmdir("s3://my-bucket")  # botocore.exceptions.ParamValidationError: Invalid bucket name "s3://my-bucket"
fs.rmdir("my-bucket/")      # same error, for "my-bucket/"

merge uses each source path as CopySource as given, so with URLs S3 is asked to copy from a bucket named s3::

fs.merge("s3://my-bucket/joined", ["s3://my-bucket/a", "s3://my-bucket/b"])
# FileNotFoundError: The specified bucket does not exist

rmdir now uses the bucket that split_path already returns, and merge strips the protocol from each source the same way _copy_managed does for its CopySource. Paths without a protocol behave as before, including ?versionId= suffixes on merge sources.

Tests: test_rmdir_bucket_url (s3://test1_bucket and test1_bucket/) and the new s3:// case of test_merge fail on main with the errors above and pass with this change. Also added a changelog entry.

I ran pytest s3fs/tests/test_s3fs.py and pre-commit (black, flake8) on the changed files. On my Windows machine test_content_type_is_not_overrided and test_get_directory_recursive fail on main too, so they're unrelated.

raams95 and others added 2 commits October 23, 2026 20:46
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:".
@martindurant
martindurant merged commit 4462eea into fsspec:main Nov 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants