mirror of
https://github.com/pgsty/minio.git
synced 2026-10-30 12:30:39 +03:00
fix: keep plain Enabled versioning when Object Lock is enabled on a bucket
Site adoption and ForceCreate preserved a suspended or prefix-excluded versioning configuration while bootstrapping Object Lock, persisting a state that PutBucketVersioning itself rejects: objects under an excluded prefix in a WORM bucket were not versioned and escaped retention. enablePeerBucketVersioning now takes the lock intent and replaces such configurations with plain Enabled versioning, and metadata loading ignores prefix exclusions on a locked bucket as it ignored suspension before. The adoption tests assert the normalized state and keep the timestamp-preservation checks on valid documents. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PvgysXDmhPBBimCReYtA8q Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -911,7 +911,7 @@ func (z *erasureServerPools) MakeBucket(ctx context.Context, bucket string, opts
|
||||
meta.SetCreatedAt(opts.CreatedAt)
|
||||
}
|
||||
if opts.LockEnabled {
|
||||
if err := enablePeerBucketVersioning(&meta); err != nil {
|
||||
if err := enablePeerBucketVersioning(&meta, true); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(meta.ObjectLockConfigXML) == 0 {
|
||||
@@ -920,7 +920,7 @@ func (z *erasureServerPools) MakeBucket(ctx context.Context, bucket string, opts
|
||||
}
|
||||
}
|
||||
if opts.VersioningEnabled {
|
||||
if err := enablePeerBucketVersioning(&meta); err != nil {
|
||||
if err := enablePeerBucketVersioning(&meta, opts.LockEnabled); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user