fix: moves the body stream reader to public buckets middleware

This commit is contained in:
niksis02
2025-07-01 23:58:00 +04:00
parent 64e705f49a
commit 668cad8fe9
2 changed files with 5 additions and 2 deletions
+3 -2
View File
@@ -15,6 +15,7 @@
package controllers
import (
"bytes"
"encoding/xml"
"errors"
"fmt"
@@ -2216,7 +2217,7 @@ func (c S3ApiController) PutActions(ctx *fiber.Ctx) error {
if bodyi != nil {
body = bodyi.(io.Reader)
} else {
body = ctx.Request().BodyStream()
body = bytes.NewReader([]byte{})
}
res, err := c.be.UploadPart(ctx.Context(),
@@ -2702,7 +2703,7 @@ func (c S3ApiController) PutActions(ctx *fiber.Ctx) error {
if bodyi != nil {
body = bodyi.(io.Reader)
} else {
body = ctx.Request().BodyStream()
body = bytes.NewReader([]byte{})
}
res, err := c.be.PutObject(ctx.Context(),
+2
View File
@@ -218,6 +218,7 @@ func detectS3Action(ctx *fiber.Ctx, isBucketAction bool) (auth.Action, auth.Perm
}
// UploadPart
utils.ContextKeyBodyReader.Set(ctx, ctx.Request().BodyStream())
return auth.PutObjectAction, auth.PermissionWrite, nil
}
if ctx.Get("X-Amz-Copy-Source") != "" {
@@ -225,6 +226,7 @@ func detectS3Action(ctx *fiber.Ctx, isBucketAction bool) (auth.Action, auth.Perm
}
// All the other requests are considered as 'PutObject' in the router
utils.ContextKeyBodyReader.Set(ctx, ctx.Request().BodyStream())
return auth.PutObjectAction, auth.PermissionWrite, nil
case fiber.MethodPost:
if isBucketAction {