Send a bucket notification event on DeleteObject() for non-existing object (#19037)

Send a bucket notification event on DeleteObject for non-existing objects
This commit is contained in:
Praveen raj Mani
2024-02-13 21:04:17 +05:30
committed by GitHub
parent cfd8645843
commit ac8e9ce04f
4 changed files with 30 additions and 2 deletions

View File

@@ -2891,6 +2891,18 @@ func (api objectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http.
return
}
if isErrObjectNotFound(err) || isErrVersionNotFound(err) {
// Send an event when the object is not found
objInfo.Name = object
objInfo.VersionID = opts.VersionID
sendEvent(eventArgs{
EventName: event.ObjectRemovedNoOP,
BucketName: bucket,
Object: objInfo,
ReqParams: extractReqParams(r),
RespElements: extractRespElements(w),
UserAgent: r.UserAgent(),
Host: handlers.GetSourceIP(r),
})
writeSuccessNoContent(w)
return
}