Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

s3api: fix ListObjectVersions inconsistency with delimiters (#8210)

Chris Luc9c46db77e44
diff --git a/weed/s3api/s3api_object_versioning.go b/weed/s3api/s3api_object_versioning.go
index 1b8ae333fb..9147ebbdfc 100644
--- a/weed/s3api/s3api_object_versioning.go
+++ b/weed/s3api/s3api_object_versioning.go
@@ -640,6 +640,24 @@ func (vc *versionCollector) collectVersions(currentPath, relativePath string) er
continue
}
+ // Handle special directories that should bypass delimiter logic
+ // This ensures .versions directories are processed as version containers
+ // rather than being rolled up into CommonPrefixes when a delimiter is used
+ if entry.IsDirectory {
+ // Skip .uploads directory
+ if strings.HasPrefix(entry.Name, s3_constants.MultipartUploadsFolder) {
+ continue
+ }
+
+ // Handle .versions directory
+ if strings.HasSuffix(entry.Name, s3_constants.VersionsFolder) {
+ if err := vc.processVersionsDirectory(entryPath); err != nil {
+ return err
+ }
+ continue
+ }
+ }
+
// Group into common prefixes if delimiter is found after the prefix
if vc.delimiter != "" {
fullKey := entryPath
@@ -688,16 +706,6 @@ func (vc *versionCollector) collectVersions(currentPath, relativePath string) er
// processDirectory handles directory entries
func (vc *versionCollector) processDirectory(currentPath, entryPath string, entry *filer_pb.Entry) error {
- // Skip .uploads directory
- if strings.HasPrefix(entry.Name, ".uploads") {
- return nil
- }
-
- // Handle .versions directory
- if strings.HasSuffix(entry.Name, s3_constants.VersionsFolder) {
- return vc.processVersionsDirectory(entryPath)
- }
-
// Handle explicit S3 directory object
if entry.Attributes.Mime == s3_constants.FolderMimeType {
vc.processExplicitDirectory(entryPath, entry)