From 0ee9678190c80b36ae4b42c0498c42746b9475e1 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 14 Sep 2020 21:32:52 -0700 Subject: [PATCH] fix: add missing delete marker created filter (#10481) --- cmd/notification.go | 2 +- pkg/event/name.go | 17 +++++++++++++---- pkg/event/name_test.go | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/cmd/notification.go b/cmd/notification.go index 0b4a2dc5d..9b7735179 100644 --- a/cmd/notification.go +++ b/cmd/notification.go @@ -1232,7 +1232,7 @@ func (args eventArgs) ToEvent(escape bool) event.Event { }, } - if args.EventName != event.ObjectRemovedDelete { + if args.EventName != event.ObjectRemovedDelete && args.EventName != event.ObjectRemovedDeleteMarkerCreated { newEvent.S3.Object.ETag = args.Object.ETag newEvent.S3.Object.Size = args.Object.Size newEvent.S3.Object.ContentType = args.Object.ContentType diff --git a/pkg/event/name.go b/pkg/event/name.go index 434661807..e698b57c6 100644 --- a/pkg/event/name.go +++ b/pkg/event/name.go @@ -56,12 +56,21 @@ func (name Name) Expand() []Name { case BucketRemoved: return []Name{BucketRemoved} case ObjectAccessedAll: - return []Name{ObjectAccessedGet, ObjectAccessedHead, ObjectAccessedGetRetention, ObjectAccessedGetLegalHold} + return []Name{ + ObjectAccessedGet, ObjectAccessedHead, + ObjectAccessedGetRetention, ObjectAccessedGetLegalHold, + } case ObjectCreatedAll: - return []Name{ObjectCreatedCompleteMultipartUpload, ObjectCreatedCopy, - ObjectCreatedPost, ObjectCreatedPut, ObjectCreatedPutRetention, ObjectCreatedPutLegalHold} + return []Name{ + ObjectCreatedCompleteMultipartUpload, ObjectCreatedCopy, + ObjectCreatedPost, ObjectCreatedPut, + ObjectCreatedPutRetention, ObjectCreatedPutLegalHold, + } case ObjectRemovedAll: - return []Name{ObjectRemovedDelete} + return []Name{ + ObjectRemovedDelete, + ObjectRemovedDeleteMarkerCreated, + } default: return []Name{name} } diff --git a/pkg/event/name_test.go b/pkg/event/name_test.go index cf81eba67..0cc8b6e9a 100644 --- a/pkg/event/name_test.go +++ b/pkg/event/name_test.go @@ -33,7 +33,7 @@ func TestNameExpand(t *testing.T) { {ObjectAccessedAll, []Name{ObjectAccessedGet, ObjectAccessedHead, ObjectAccessedGetRetention, ObjectAccessedGetLegalHold}}, {ObjectCreatedAll, []Name{ObjectCreatedCompleteMultipartUpload, ObjectCreatedCopy, ObjectCreatedPost, ObjectCreatedPut, ObjectCreatedPutRetention, ObjectCreatedPutLegalHold}}, - {ObjectRemovedAll, []Name{ObjectRemovedDelete}}, + {ObjectRemovedAll, []Name{ObjectRemovedDelete, ObjectRemovedDeleteMarkerCreated}}, {ObjectAccessedHead, []Name{ObjectAccessedHead}}, }