Browse Source

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

fix https://github.com/seaweedfs/seaweedfs/issues/5748
pull/5759/head
chrislu 6 months ago
parent
commit
f618121e63
  1. 5
      weed/s3api/s3api_object_handlers_delete.go

5
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) bucket, object := s3_constants.GetBucketAndObject(r)
glog.V(3).Infof("DeleteObjectHandler %s %s", bucket, object) 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 { 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 { if err != nil {
// skip deletion error, usually the file is not found // skip deletion error, usually the file is not found
return nil return nil

Loading…
Cancel
Save