aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-07-18 20:55:12 -0700
committerchrislu <chris.lu@gmail.com>2025-07-18 20:55:12 -0700
commit8fb9df72ae5648a938d9d5b741f214fe7401f6ab (patch)
tree38bcd337f823120a7c61b01875405271d22167fb
parentaf25f92e36cbfb9d51e1e9b3eddc1707d46b1fb1 (diff)
downloadseaweedfs-8fb9df72ae5648a938d9d5b741f214fe7401f6ab.tar.xz
seaweedfs-8fb9df72ae5648a938d9d5b741f214fe7401f6ab.zip
fix tests
-rw-r--r--weed/s3api/s3api_object_handlers_put.go6
-rw-r--r--weed/s3api/s3api_object_lock_headers_test.go2
2 files changed, 4 insertions, 4 deletions
diff --git a/weed/s3api/s3api_object_handlers_put.go b/weed/s3api/s3api_object_handlers_put.go
index 3241802fa..07ddebf43 100644
--- a/weed/s3api/s3api_object_handlers_put.go
+++ b/weed/s3api/s3api_object_handlers_put.go
@@ -573,9 +573,9 @@ func mapValidationErrorToS3Error(err error) s3err.ErrorCode {
// This matches the test expectations
return s3err.ErrInvalidRequest
case errors.Is(err, ErrInvalidLegalHoldStatus):
- // For invalid legal hold status, return InvalidRequest
- // This matches the test expectations for invalid parameter values
- return s3err.ErrInvalidRequest
+ // For invalid legal hold status in XML body, return MalformedXML
+ // AWS S3 treats invalid status values in XML as malformed content
+ return s3err.ErrMalformedXML
case errors.Is(err, ErrInvalidRetentionDateFormat):
// For malformed retention date format, return MalformedDate
// This matches the test expectations
diff --git a/weed/s3api/s3api_object_lock_headers_test.go b/weed/s3api/s3api_object_lock_headers_test.go
index 111aa0fa9..fc8a01232 100644
--- a/weed/s3api/s3api_object_lock_headers_test.go
+++ b/weed/s3api/s3api_object_lock_headers_test.go
@@ -568,7 +568,7 @@ func TestMapValidationErrorToS3Error(t *testing.T) {
{
name: "ErrInvalidLegalHoldStatus",
inputError: ErrInvalidLegalHoldStatus,
- expectedCode: s3err.ErrInvalidRequest,
+ expectedCode: s3err.ErrMalformedXML,
},
{
name: "ErrInvalidRetentionDateFormat",