Upstream versity/versitygw state of the touched files before c02173db7a
This commit is contained in:
1 parent
b8628c396f
commit
295bb05dd1
5 files changed
+3
-59
No files matched your search
@@ -22,7 +22,6 @@ import (
|
||||
"github.com/gofiber/fiber/v3"
|
||||
"github.com/versity/versitygw/auth"
|
||||
"github.com/versity/versitygw/s3api/utils"
|
||||
"github.com/versity/versitygw/s3err"
|
||||
"github.com/versity/versitygw/s3response"
|
||||
)
|
||||
|
||||
@@ -615,15 +614,6 @@ func (c S3ApiController) ListObjects(ctx fiber.Ctx) (*Response, error) {
|
||||
region = defaultRegion
|
||||
}
|
||||
|
||||
// start-after is a ListObjectsV2 argument, S3 rejects it on a V1 listing
|
||||
if ctx.Query("start-after") != "" {
|
||||
return &Response{
|
||||
MetaOpts: &MetaOptions{
|
||||
BucketOwner: parsedAcl.Owner,
|
||||
},
|
||||
}, s3err.GetInvalidArgumentErr(s3err.InvalidArgStartAfter, "")
|
||||
}
|
||||
|
||||
err := c.verifyAccess(ctx, auth.AccessOptions{
|
||||
Acl: parsedAcl,
|
||||
AclPermission: auth.PermissionRead,
|
||||
|
||||
@@ -1195,24 +1195,6 @@ func TestS3ApiController_ListObjects(t *testing.T) {
|
||||
err: s3err.GetAPIError(s3err.ErrAccessDenied),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "start-after is not supported",
|
||||
input: testInput{
|
||||
locals: defaultLocals,
|
||||
beRes: listResult,
|
||||
queries: map[string]string{
|
||||
"start-after": "my-key",
|
||||
},
|
||||
},
|
||||
output: testOutput{
|
||||
response: &Response{
|
||||
MetaOpts: &MetaOptions{
|
||||
BucketOwner: "root",
|
||||
},
|
||||
},
|
||||
err: s3err.GetInvalidArgumentErr(s3err.InvalidArgStartAfter, ""),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "invalid max keys",
|
||||
input: testInput{
|
||||
|
||||
@@ -17,8 +17,6 @@ package integration
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
||||
"github.com/aws/aws-sdk-go-v2/service/s3/types"
|
||||
@@ -195,33 +193,6 @@ func ListObjects_invalid_max_keys(s *S3Conf) error {
|
||||
})
|
||||
}
|
||||
|
||||
// start-after belongs to ListObjectsV2, so S3 rejects it on a V1 listing
|
||||
// instead of ignoring it. The SDK ListObjects input has no StartAfter field,
|
||||
// so the request is signed and sent by hand.
|
||||
func ListObjects_start_after(s *S3Conf) error {
|
||||
testName := "ListObjects_start_after"
|
||||
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
|
||||
_, err := putObjects(s3client, []string{"bar", "baz", "foo"}, bucket)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
req, err := createSignedReq(http.MethodGet, s.endpoint,
|
||||
fmt.Sprintf("%v?start-after=bar", bucket),
|
||||
s.awsID, s.awsSecret, "s3", s.awsRegion, "", nil, time.Now(), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resp, err := s.httpClient.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return checkHTTPResponseApiErr(resp, s3err.GetInvalidArgumentErr(s3err.InvalidArgStartAfter, ""))
|
||||
})
|
||||
}
|
||||
|
||||
func ListObjects_max_keys_0(s *S3Conf) error {
|
||||
testName := "ListObjects_max_keys_0"
|
||||
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
|
||||
|
||||
@@ -314,7 +314,6 @@ func TestListObjects(ts *TestState) {
|
||||
ts.Run(ListObjects_truncated)
|
||||
ts.Run(ListObjects_paginated)
|
||||
ts.Run(ListObjects_invalid_max_keys)
|
||||
ts.Run(ListObjects_start_after)
|
||||
ts.Run(ListObjects_max_keys_0)
|
||||
ts.Run(ListObjects_exceeding_max_keys)
|
||||
ts.Run(ListObjects_delimiter)
|
||||
@@ -3154,7 +3153,6 @@ func GetIntTests() IntTests {
|
||||
"ListObjects_truncated": ListObjects_truncated,
|
||||
"ListObjects_paginated": ListObjects_paginated,
|
||||
"ListObjects_invalid_max_keys": ListObjects_invalid_max_keys,
|
||||
"ListObjects_start_after": ListObjects_start_after,
|
||||
"ListObjects_max_keys_0": ListObjects_max_keys_0,
|
||||
"ListObjects_delimiter": ListObjects_delimiter,
|
||||
"ListObjects_max_keys_none": ListObjects_max_keys_none,
|
||||
|
||||
@@ -248,6 +248,9 @@ source ./tests/drivers/objects_and_versions.sh
|
||||
|
||||
# tags: curl,ListObjects,start-after,invalid-query
|
||||
@test "ListObjectsV1 - start-after - error" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/2004"
|
||||
fi
|
||||
run setup_bucket_and_files_v3 "$BUCKET_ONE_NAME" 2
|
||||
assert_success
|
||||
read -r bucket_name file_one file_two <<< "$output"
|
||||
|
||||
Reference in new issue
Block a user