fix: Changes the error type to MalformedXML for PutObjectRetention and PutObjectLegalHold empty or invalid body

Fixes #1185
Fixes #1191

`PutObjectLegalHold` and `PutObjectRetention` should return `MalformedXML` if the request body is empty or invalid.`
This commit is contained in:
niksis02
2025-04-08 19:01:00 +04:00
parent 7a3de637e4
commit 20d00f7f6d
3 changed files with 3 additions and 3 deletions

View File

@@ -1969,7 +1969,7 @@ func (c S3ApiController) PutActions(ctx *fiber.Ctx) error {
if ctx.Request().URI().QueryArgs().Has("legal-hold") {
var legalHold types.ObjectLockLegalHold
if err := xml.Unmarshal(ctx.Body(), &legalHold); err != nil {
return SendResponse(ctx, s3err.GetAPIError(s3err.ErrInvalidRequest),
return SendResponse(ctx, s3err.GetAPIError(s3err.ErrMalformedXML),
&MetaOpts{
Logger: c.logger,
MetricsMng: c.mm,