diff --git a/cmd/bucket-handlers.go b/cmd/bucket-handlers.go index ceed0320f..5ec439f3a 100644 --- a/cmd/bucket-handlers.go +++ b/cmd/bucket-handlers.go @@ -527,7 +527,7 @@ func (api objectAPIHandlers) DeleteMultipleObjectsHandler(w http.ResponseWriter, VersionSuspended: vc.Suspended(), } - if replicateDeletes || object.VersionID != "" && hasLockEnabled || !globalTierConfigMgr.Empty() { + if replicateDeletes || hasLockEnabled || !globalTierConfigMgr.Empty() { if !globalTierConfigMgr.Empty() && object.VersionID == "" && opts.VersionSuspended { opts.VersionID = nullVersionID } @@ -556,7 +556,7 @@ func (api objectAPIHandlers) DeleteMultipleObjectsHandler(w http.ResponseWriter, object.ReplicateDecisionStr = dsc.String() } } - if object.VersionID != "" && hasLockEnabled { + if hasLockEnabled { if apiErrCode := enforceRetentionBypassForDelete(ctx, r, bucket, object, goi, gerr); apiErrCode != ErrNone { apiErr := errorCodes.ToAPIErr(apiErrCode) deleteResults[index].errInfo = DeleteError{ diff --git a/cmd/object-handlers.go b/cmd/object-handlers.go index 48123c464..43d602680 100644 --- a/cmd/object-handlers.go +++ b/cmd/object-handlers.go @@ -3453,17 +3453,15 @@ func (api objectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http. writeErrorResponse(ctx, w, toAPIError(ctx, errors.New("force-delete is forbidden in a locked-enabled bucket")), r.URL) return } - if vID != "" { - apiErr = enforceRetentionBypassForDelete(ctx, r, bucket, ObjectToDelete{ - ObjectV: ObjectV{ - ObjectName: object, - VersionID: vID, - }, - }, goi, gerr) - if apiErr != ErrNone && apiErr != ErrNoSuchKey { - writeErrorResponse(ctx, w, errorCodes.ToAPIErr(apiErr), r.URL) - return - } + apiErr = enforceRetentionBypassForDelete(ctx, r, bucket, ObjectToDelete{ + ObjectV: ObjectV{ + ObjectName: object, + VersionID: vID, + }, + }, goi, gerr) + if apiErr != ErrNone && apiErr != ErrNoSuchKey { + writeErrorResponse(ctx, w, errorCodes.ToAPIErr(apiErr), r.URL) + return } }