Fix S3 deletion in deep folders, and names with empty spaces

fix https://github.com/seaweedfs/seaweedfs/issues/5748
This commit is contained in:
chrislu 2024-07-08 10:20:07 -07:00
parent e8c50e65b3
commit f618121e63

View File

@ -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