1
0
mirror of https://github.com/minio/minio.git synced 2025-04-11 15:07:48 -04:00

erasure-sd: Evaluate versioning Prefix in multi-delete objects ()

Erasure SD DeleteObjects() is only inheriting bucket versioning status
from the handler layer.

Add the missing versioning prefix evaluation for each object that will
deleted.
This commit is contained in:
Anis Elleuch 2022-06-14 18:05:12 +01:00 committed by GitHub
parent f34b2ef90b
commit 14645142db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1203,7 +1203,14 @@ func (es *erasureSingle) DeleteObjects(ctx context.Context, bucket string, objec
// VersionID is not set means delete is not specific about // VersionID is not set means delete is not specific about
// any version, look for if the bucket is versioned or not. // any version, look for if the bucket is versioned or not.
if objects[i].VersionID == "" { if objects[i].VersionID == "" {
if opts.Versioned || opts.VersionSuspended { // MinIO extension to bucket version configuration
suspended := opts.VersionSuspended
versioned := opts.Versioned
if opts.PrefixEnabledFn != nil {
versioned = opts.PrefixEnabledFn(objects[i].ObjectName)
}
if versioned || suspended {
// Bucket is versioned and no version was explicitly // Bucket is versioned and no version was explicitly
// mentioned for deletes, create a delete marker instead. // mentioned for deletes, create a delete marker instead.
vr.ModTime = UTCNow() vr.ModTime = UTCNow()
@ -1211,7 +1218,7 @@ func (es *erasureSingle) DeleteObjects(ctx context.Context, bucket string, objec
// Versioning suspended means that we add a `null` version // Versioning suspended means that we add a `null` version
// delete marker, if not add a new version for this delete // delete marker, if not add a new version for this delete
// marker. // marker.
if opts.Versioned { if versioned {
vr.VersionID = mustGetUUID() vr.VersionID = mustGetUUID()
} }
} }