Skip to content

Conversation

@Numblgw
Copy link

@Numblgw Numblgw commented Nov 6, 2025

Checklist for Pull Requests


Description
image
Directories automatically created via the S3 protocol are returned as common prefixes during list queries. However, some S3 implementations do not support HEAD requests for common prefixes, and empty common prefixes are not automatically removed when objects are deleted. In such cases, when performing a stat operation, both the headObject and getStatForDir functions will return errors, making it necessary to rely on the hasContents function to correctly identify directories (common prefixes). However, when a directory (common prefix) contains only subdirectories (also common prefixes) and no objects, this function fails to work correctly. As a result, the directory (common prefix) cannot be properly removed (rm) or accessed (cd).

@Numblgw Numblgw requested a review from drakkan as a code owner November 6, 2025 11:33
@CLAassistant
Copy link

CLAassistant commented Nov 6, 2025

CLA assistant check
All committers have signed the CLA.

@Numblgw Numblgw force-pushed the bugfix_stat_s3_common_prefix branch from 31a4765 to 462e28d Compare November 6, 2025 11:43
@drakkan
Copy link
Owner

drakkan commented Nov 9, 2025

Hello, thanks for the PR.

I assume this change is meant to improve compatibility with implementations like SeaweedFS.
We'll take it into consideration when adding support for directory buckets.

If SeaweedFS (or your target implementation) behaves like S3 when directory buckets are enabled, it will be supported automatically. Otherwise, it’s the external implementation’s responsibility to align with S3 behavior.

In the long term, we’d like to remove workarounds such as this altogether.

@drakkan
Copy link
Owner

drakkan commented Nov 9, 2025

Please refer to the following documentation if you are using SeaweedFS. Otherwise, please provide more details about your S3 implementation.

https://github.com/seaweedfs/seaweedfs/wiki/Amazon-S3-API#empty-folders

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.

3 participants