diff options
| author | chrislu <chris.lu@gmail.com> | 2025-07-18 15:52:28 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-07-18 15:52:28 -0700 |
| commit | 1bc503530a4e7c566242e0b9067f18daec2a349c (patch) | |
| tree | 7c859c8b307019ada994fd377cf09eedd144bc1f /weed/s3api/s3api_object_handlers_put.go | |
| parent | 9f88fd2ea5ca08e430d22d3335f4c96acfa665e4 (diff) | |
| download | seaweedfs-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.go | 8 |
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 |
