aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_object_handlers_put.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-07-18 15:52:28 -0700
committerchrislu <chris.lu@gmail.com>2025-07-18 15:52:28 -0700
commit1bc503530a4e7c566242e0b9067f18daec2a349c (patch)
tree7c859c8b307019ada994fd377cf09eedd144bc1f /weed/s3api/s3api_object_handlers_put.go
parent9f88fd2ea5ca08e430d22d3335f4c96acfa665e4 (diff)
downloadseaweedfs-1bc503530a4e7c566242e0b9067f18daec2a349c.tar.xz
seaweedfs-1bc503530a4e7c566242e0b9067f18daec2a349c.zip
fixes
With these final fixes, the s3-tests should now: ✅ Return MalformedXML for ObjectLockEnabled: 'Disabled' ✅ Return MalformedXML when both Days and Years are specified in retention configuration ✅ Return InvalidBucketState (409 Conflict) when trying to suspend versioning on buckets with object lock enabled ✅ Handle all object lock validation errors consistently with proper error codes
Diffstat (limited to 'weed/s3api/s3api_object_handlers_put.go')
-rw-r--r--weed/s3api/s3api_object_handlers_put.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/weed/s3api/s3api_object_handlers_put.go b/weed/s3api/s3api_object_handlers_put.go
index d2c774aee..446b78fde 100644
--- a/weed/s3api/s3api_object_handlers_put.go
+++ b/weed/s3api/s3api_object_handlers_put.go
@@ -559,17 +559,19 @@ func mapValidationErrorToS3Error(err error) s3err.ErrorCode {
// This matches AWS S3 behavior and s3-tests expectations
return s3err.ErrInvalidBucketState
case errors.Is(err, ErrInvalidObjectLockMode):
- return s3err.ErrInvalidRequest
+ return s3err.ErrMalformedXML
case errors.Is(err, ErrInvalidLegalHoldStatus):
// For malformed legal hold status, return MalformedXML as expected by s3-tests
return s3err.ErrMalformedXML
case errors.Is(err, ErrInvalidRetentionDateFormat):
return s3err.ErrMalformedXML
case errors.Is(err, ErrInvalidRetentionPeriod):
- // For invalid retention periods (days/years), return InvalidRetentionPeriod
- return s3err.ErrInvalidRetentionPeriod
+ // For invalid retention periods (days/years), return MalformedXML
+ // This includes cases where both Days and Years are specified
+ return s3err.ErrMalformedXML
case errors.Is(err, ErrInvalidRetentionMode):
// For invalid retention modes, return MalformedXML
+ // This includes cases where ObjectLockEnabled is 'Disabled'
return s3err.ErrMalformedXML
default:
return s3err.ErrInvalidRequest