diff options
| author | chrislu <chris.lu@gmail.com> | 2025-07-18 16:17:36 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-07-18 16:17:36 -0700 |
| commit | 1e1806c7a1d79dda607e4802aef06b354db8c888 (patch) | |
| tree | 6f7ba4cd1cffbd3e82145119a5192dcbb639785a /weed/s3api/s3api_object_retention.go | |
| parent | eaaef569cedd0063c990acad7693cf1d43cfce28 (diff) | |
| download | seaweedfs-1e1806c7a1d79dda607e4802aef06b354db8c888.tar.xz seaweedfs-1e1806c7a1d79dda607e4802aef06b354db8c888.zip | |
fixes
✅ Include VersionId in multipart upload completion responses when versioning is enabled
✅ Block retention mode changes (GOVERNANCE ↔ COMPLIANCE) without bypass permissions
✅ Handle all object lock validation errors consistently with proper error codes
✅ Pass the remaining object lock tests
Diffstat (limited to 'weed/s3api/s3api_object_retention.go')
| -rw-r--r-- | weed/s3api/s3api_object_retention.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/weed/s3api/s3api_object_retention.go b/weed/s3api/s3api_object_retention.go index 671ab0858..93bd618d3 100644 --- a/weed/s3api/s3api_object_retention.go +++ b/weed/s3api/s3api_object_retention.go @@ -348,6 +348,20 @@ func (s3a *S3ApiServer) setObjectRetention(bucket, object, versionId string, ret // Check if object is already under retention if entry.Extended != nil { if existingMode, exists := entry.Extended[s3_constants.ExtObjectLockModeKey]; exists { + // Check if attempting to change retention mode + if retention.Mode != "" && string(existingMode) != retention.Mode { + // Attempting to change retention mode + if string(existingMode) == s3_constants.RetentionModeCompliance { + // Cannot change compliance mode retention without bypass + return ErrComplianceModeActive + } + + if string(existingMode) == s3_constants.RetentionModeGovernance && !bypassGovernance { + // Cannot change governance mode retention without bypass + return ErrGovernanceModeActive + } + } + if existingDateBytes, dateExists := entry.Extended[s3_constants.ExtRetentionUntilDateKey]; dateExists { if timestamp, err := strconv.ParseInt(string(existingDateBytes), 10, 64); err == nil { existingDate := time.Unix(timestamp, 0) |
