Ensure actual object size is sent in notification (#8418)

Fixes: #8407
This commit is contained in:
poornas
2019-10-20 23:48:19 -07:00
committed by Harshavardhana
parent 7bf093c06a
commit 1b74ce3924
2 changed files with 9 additions and 8 deletions

View File

@@ -1191,6 +1191,15 @@ func (args eventArgs) ToEvent() event.Event {
func sendEvent(args eventArgs) {
// remove sensitive encryption entries in metadata.
switch {
case crypto.IsEncrypted(args.Object.UserDefined):
if totalObjectSize, err := args.Object.DecryptedSize(); err == nil {
args.Object.Size = totalObjectSize
}
case args.Object.IsCompressed():
args.Object.Size = args.Object.GetActualSize()
}
crypto.RemoveSensitiveEntries(args.Object.UserDefined)
crypto.RemoveInternalEntries(args.Object.UserDefined)