fix: reject ListMultipartUploads requests that also carry uploadId
A bucket GET with both the uploads and uploadId query parameters was routed to ListMultipartUploads and answered with the upload listing. S3 rejects the combination with 400 InvalidArgument, "Conflicting query string parameters: uploadId, uploads". Add an error route for the combination ahead of ListMultipartUploads, the way the object level '?uploads' request is rejected, and enable the REST test that covers it. Fixes #2155
This commit is contained in:
1 parent
6704314fea
commit
5f0e2e55ba
5 files changed
+37
-3
No files matched your search
@@ -17,6 +17,7 @@ package integration
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -579,6 +580,30 @@ func ListMultipartUploads_delimiter_no_matches(s *S3Conf) error {
|
||||
})
|
||||
}
|
||||
|
||||
func ListMultipartUploads_with_upload_id(s *S3Conf) error {
|
||||
testName := "ListMultipartUploads_with_upload_id"
|
||||
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
|
||||
out, err := createMp(s3client, bucket, "my-obj")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
req, err := createSignedReq(http.MethodGet, s.endpoint,
|
||||
fmt.Sprintf("%v?uploads&uploadId=%v", bucket, *out.UploadId),
|
||||
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.InvalidArgUploadIdWithUploads, "uploadId"))
|
||||
})
|
||||
}
|
||||
|
||||
func ListMultipartUploads_with_checksums(s *S3Conf) error {
|
||||
testName := "ListMultipartUploads_with_checksums"
|
||||
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
|
||||
|
||||
@@ -554,6 +554,7 @@ func TestListMultipartUploads(ts *TestState) {
|
||||
ts.Run(ListMultipartUploads_prefix)
|
||||
ts.Run(ListMultipartUploads_both_delimiter_and_prefix)
|
||||
ts.Run(ListMultipartUploads_delimiter_no_matches)
|
||||
ts.Run(ListMultipartUploads_with_upload_id)
|
||||
//TODO: remove the condition after implementing checksums in azure
|
||||
if !ts.conf.azureTests {
|
||||
ts.Run(ListMultipartUploads_with_checksums)
|
||||
@@ -3288,6 +3289,7 @@ func GetIntTests() IntTests {
|
||||
"ListMultipartUploads_delimiter_truncated": ListMultipartUploads_delimiter_truncated,
|
||||
"ListMultipartUploads_prefix": ListMultipartUploads_prefix,
|
||||
"ListMultipartUploads_both_delimiter_and_prefix": ListMultipartUploads_both_delimiter_and_prefix,
|
||||
"ListMultipartUploads_with_upload_id": ListMultipartUploads_with_upload_id,
|
||||
"ListMultipartUploads_with_checksums": ListMultipartUploads_with_checksums,
|
||||
"AbortMultipartUpload_non_existing_bucket": AbortMultipartUpload_non_existing_bucket,
|
||||
"AbortMultipartUpload_incorrect_uploadId": AbortMultipartUpload_incorrect_uploadId,
|
||||
|
||||
Reference in new issue
Block a user