From 48aec1956eb8159fe65a8aff02b13f32fa4749b7 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 10 Feb 2026 17:46:25 -0800 Subject: [PATCH] Seaweed-X-Amz-Allow-Empty-Folders --- weed/command/mount_std.go | 10 +++++----- weed/s3api/s3_constants/extend_key.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go index af5ef994e..d71771954 100644 --- a/weed/command/mount_std.go +++ b/weed/command/mount_std.go @@ -61,7 +61,7 @@ func runMount(cmd *Command, args []string) bool { return RunMount(&mountOptions, os.FileMode(umask)) } -func ensureBucketAutoRemoveEmptyFoldersDisabled(ctx context.Context, filerClient filer_pb.FilerClient, mountRoot, bucketRootPath string) error { +func ensureBucketAllowEmptyFolders(ctx context.Context, filerClient filer_pb.FilerClient, mountRoot, bucketRootPath string) error { bucketPath, isBucketRootMount := bucketPathForMountRoot(mountRoot, bucketRootPath) if !isBucketRootMount { return nil @@ -78,11 +78,11 @@ func ensureBucketAutoRemoveEmptyFoldersDisabled(ctx context.Context, filerClient if entry.Extended == nil { entry.Extended = make(map[string][]byte) } - if strings.EqualFold(strings.TrimSpace(string(entry.Extended[s3_constants.ExtAutoRemoveEmptyFolders])), "false") { + if strings.EqualFold(strings.TrimSpace(string(entry.Extended[s3_constants.ExtAllowEmptyFolders])), "true") { return nil } - entry.Extended[s3_constants.ExtAutoRemoveEmptyFolders] = []byte("false") + entry.Extended[s3_constants.ExtAllowEmptyFolders] = []byte("true") bucketFullPath := util.FullPath(bucketPath) parent, _ := bucketFullPath.DirAndName() @@ -95,7 +95,7 @@ func ensureBucketAutoRemoveEmptyFoldersDisabled(ctx context.Context, filerClient return err } - glog.Infof("RunMount: set bucket %s %s=false", bucketPath, s3_constants.ExtAutoRemoveEmptyFolders) + glog.Infof("RunMount: set bucket %s %s=true", bucketPath, s3_constants.ExtAllowEmptyFolders) return nil } @@ -351,7 +351,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool { fmt.Printf("failed to create dir %s on filer %s: %v\n", mountRoot, filerAddresses, err) return false } - if err := ensureBucketAutoRemoveEmptyFoldersDisabled(context.Background(), seaweedFileSystem, mountRoot, bucketRootPath); err != nil { + if err := ensureBucketAllowEmptyFolders(context.Background(), seaweedFileSystem, mountRoot, bucketRootPath); err != nil { fmt.Printf("failed to set bucket auto-remove-empty-folders policy for %s: %v\n", mountRoot, err) return false } diff --git a/weed/s3api/s3_constants/extend_key.go b/weed/s3api/s3_constants/extend_key.go index 612a6416b..bb3d637d1 100644 --- a/weed/s3api/s3_constants/extend_key.go +++ b/weed/s3api/s3_constants/extend_key.go @@ -11,7 +11,7 @@ const ( ExtETagKey = "Seaweed-X-Amz-ETag" ExtLatestVersionIdKey = "Seaweed-X-Amz-Latest-Version-Id" ExtLatestVersionFileNameKey = "Seaweed-X-Amz-Latest-Version-File-Name" - ExtAutoRemoveEmptyFolders = "Seaweed-X-Amz-Auto-Remove-Empty-Folders" + ExtAllowEmptyFolders = "Seaweed-X-Amz-Allow-Empty-Folders" // Cached list metadata in .versions directory for single-scan efficiency ExtLatestVersionSizeKey = "Seaweed-X-Amz-Latest-Version-Size" ExtLatestVersionETagKey = "Seaweed-X-Amz-Latest-Version-ETag"