fix: restore deletion audit of individual objects (#6644)

This commit is contained in:
SmoothDenis
2025-03-18 19:01:54 +07:00
committed by GitHub
parent 7244a3d047
commit e60aa71890
4 changed files with 26 additions and 4 deletions

View File

@@ -32,12 +32,23 @@ func (s3a *S3ApiServer) DeleteObjectHandler(w http.ResponseWriter, r *http.Reque
target := util.FullPath(fmt.Sprintf("%s/%s%s", s3a.option.BucketsPath, bucket, object))
dir, name := target.DirAndName()
var auditLog *s3err.AccessLog
if s3err.Logger != nil {
auditLog = s3err.GetAccessLog(r, http.StatusNoContent, s3err.ErrNone)
}
err := s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {
if err := doDeleteEntry(client, dir, name, true, false); err != nil {
return err
}
if auditLog != nil {
auditLog.Key = name
s3err.PostAccessLog(*auditLog)
}
if s3a.option.AllowEmptyFolder {
return nil
}

View File

@@ -3,12 +3,13 @@ package s3err
import (
"encoding/json"
"fmt"
"github.com/fluent/fluent-logger-golang/fluent"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
"net/http"
"os"
"time"
"github.com/fluent/fluent-logger-golang/fluent"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
)
type AccessLogExtend struct {