aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_bucket_handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/s3api/s3api_bucket_handlers.go')
-rw-r--r--weed/s3api/s3api_bucket_handlers.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/weed/s3api/s3api_bucket_handlers.go b/weed/s3api/s3api_bucket_handlers.go
index e30f172a7..2ecac4d11 100644
--- a/weed/s3api/s3api_bucket_handlers.go
+++ b/weed/s3api/s3api_bucket_handlers.go
@@ -758,6 +758,17 @@ func (s3a *S3ApiServer) PutBucketVersioningHandler(w http.ResponseWriter, r *htt
return
}
+ // Check if trying to suspend versioning on a bucket with object lock enabled
+ if status == "Suspended" {
+ // Get bucket configuration to check for object lock
+ bucketConfig, errCode := s3a.getBucketConfig(bucket)
+ if errCode == s3err.ErrNone && bucketConfig.ObjectLockConfig != nil {
+ // Object lock is enabled, cannot suspend versioning
+ s3err.WriteErrorResponse(w, r, s3err.ErrInvalidBucketState)
+ return
+ }
+ }
+
// Update bucket versioning configuration using new bucket config system
if errCode := s3a.setBucketVersioningStatus(bucket, status); errCode != s3err.ErrNone {
glog.Errorf("PutBucketVersioningHandler save config: %d", errCode)