mirror of
https://github.com/versity/versitygw.git
synced 2026-09-19 06:32:10 +00:00
fix: Removed ObjectLockConfigurationNotFoundError, when attempting to set bucket versioning status to suspended
This commit is contained in:
@@ -466,15 +466,17 @@ func (p *Posix) PutBucketVersioning(ctx context.Context, bucket string, status t
|
||||
versioning = []byte{1}
|
||||
case types.BucketVersioningStatusSuspended:
|
||||
lockRaw, err := p.GetObjectLockConfiguration(ctx, bucket)
|
||||
if err != nil {
|
||||
if err != nil && !errors.Is(err, s3err.GetAPIError(s3err.ErrObjectLockConfigurationNotFound)) {
|
||||
return err
|
||||
}
|
||||
lockStatus, err := auth.ParseBucketLockConfigurationOutput(lockRaw)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if lockStatus.ObjectLockEnabled == types.ObjectLockEnabledEnabled {
|
||||
return s3err.GetAPIError(s3err.ErrSuspendedVersioningNotAllowed)
|
||||
if err == nil {
|
||||
lockStatus, err := auth.ParseBucketLockConfigurationOutput(lockRaw)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if lockStatus.ObjectLockEnabled == types.ObjectLockEnabledEnabled {
|
||||
return s3err.GetAPIError(s3err.ErrSuspendedVersioningNotAllowed)
|
||||
}
|
||||
}
|
||||
|
||||
// '0' maps to 'Suspended'
|
||||
|
||||
Reference in New Issue
Block a user