diff options
| author | chrislu <chris.lu@gmail.com> | 2025-11-05 22:40:24 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-11-05 22:40:24 -0800 |
| commit | de24b2e42c67d9cc96f7ff97660e505ef58c96d1 (patch) | |
| tree | 9454b4e0952b83a1334a97e06b37862f20270b83 | |
| parent | 1cd8a591b9137d0e3ce97bedbd857b4c13fc0d94 (diff) | |
| download | seaweedfs-de24b2e42c67d9cc96f7ff97660e505ef58c96d1.tar.xz seaweedfs-de24b2e42c67d9cc96f7ff97660e505ef58c96d1.zip | |
simplify
| -rw-r--r-- | weed/filer/filer.go | 10 | ||||
| -rw-r--r-- | weed/server/filer_grpc_server.go | 4 |
2 files changed, 6 insertions, 8 deletions
diff --git a/weed/filer/filer.go b/weed/filer/filer.go index 9fceb879c..dc182f92b 100644 --- a/weed/filer/filer.go +++ b/weed/filer/filer.go @@ -440,13 +440,9 @@ func (f *Filer) doListDirectoryEntries(ctx context.Context, p util.FullPath, sta var stopAtPath util.FullPath if strings.HasPrefix(string(p), f.DirBucketsPath+"/") { // S3 path: stop at the bucket root (e.g., /buckets/mybucket) - pathAfterBuckets := string(p)[len(f.DirBucketsPath)+1:] - parts := strings.SplitN(pathAfterBuckets, "/", 2) - if len(parts) > 0 { - stopAtPath = util.NewFullPath(f.DirBucketsPath, parts[0]) - } else { - stopAtPath = util.FullPath(f.DirBucketsPath) - } + pathAfterBuckets := strings.TrimPrefix(string(p), f.DirBucketsPath+"/") + bucketName, _, _ := strings.Cut(pathAfterBuckets, "/") + stopAtPath = util.NewFullPath(f.DirBucketsPath, bucketName) } else { // Non-S3 path: allow cleanup up to root stopAtPath = "/" diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.go index 6a2a3d28f..34c5eb773 100644 --- a/weed/server/filer_grpc_server.go +++ b/weed/server/filer_grpc_server.go @@ -305,7 +305,9 @@ func (fs *FilerServer) DeleteEntry(ctx context.Context, req *filer_pb.DeleteEntr if req.DeleteEmptyParentDirectories { stopAtPath := util.FullPath(req.DeleteEmptyParentDirectoriesStopPath) if stopAtPath == "" { - stopAtPath = util.FullPath(fs.filer.DirBucketsPath) + // Default to root to allow cleanup for non-S3 paths + // S3 API clients provide a specific bucket stop path + stopAtPath = "/" } // Clean up empty parent directories starting from req.Directory |
