mirror of
https://github.com/versity/versitygw.git
synced 2026-07-31 12:33:00 +00:00
fix: moves the body stream reader to public buckets middleware
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user