From f618121e63f6897e88e4c7f6b5df1f6c8f98f105 Mon Sep 17 00:00:00 2001 From: chrislu Date: Mon, 8 Jul 2024 10:20:07 -0700 Subject: [PATCH] Fix S3 deletion in deep folders, and names with empty spaces fix https://github.com/seaweedfs/seaweedfs/issues/5748 --- weed/s3api/s3api_object_handlers_delete.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/weed/s3api/s3api_object_handlers_delete.go b/weed/s3api/s3api_object_handlers_delete.go index 580578593..de05081b7 100644 --- a/weed/s3api/s3api_object_handlers_delete.go +++ b/weed/s3api/s3api_object_handlers_delete.go @@ -27,11 +27,12 @@ func (s3a *S3ApiServer) DeleteObjectHandler(w http.ResponseWriter, r *http.Reque bucket, object := s3_constants.GetBucketAndObject(r) glog.V(3).Infof("DeleteObjectHandler %s %s", bucket, object) - object = urlPathEscape(removeDuplicateSlashes(object)) + target := util.FullPath(fmt.Sprintf("%s/%s%s", s3a.option.BucketsPath, bucket, object)) + dir, name := target.DirAndName() s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { - err := doDeleteEntry(client, s3a.option.BucketsPath+"/"+bucket, object, true, false) + err := doDeleteEntry(client, dir, name, true, false) if err != nil { // skip deletion error, usually the file is not found return nil