mirror of
https://github.com/pgsty/minio.git
synced 2026-09-05 18:16:16 +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:
@@ -378,8 +378,10 @@ func (b *BucketMetadata) parseAllConfigs(ctx context.Context, objectAPI ObjectLa
|
||||
}
|
||||
|
||||
if bytes.Equal(b.ObjectLockConfigXML, enabledBucketObjectLockConfig) {
|
||||
// A locked bucket needs plain Enabled versioning; suspended or
|
||||
// prefix-excluded configurations are not honored for it.
|
||||
config, versioningErr := versioning.ParseConfig(bytes.NewReader(b.VersioningConfigXML))
|
||||
if versioningErr != nil || !config.Enabled() {
|
||||
if versioningErr != nil || !config.Enabled() || config.PrefixesExcluded() {
|
||||
b.VersioningConfigXML = enabledBucketVersioningConfig
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user