mirror of
https://github.com/versity/versitygw.git
synced 2026-01-07 12:15:18 +00:00
fix: adds an error route for ?versions subresource with key
Fixes #1688 S3 returns a specific `InvalidRequest` error for the requests with `?versions` query param against `object` resource. The PR implements this error route.
This commit is contained in:
@@ -189,6 +189,23 @@ func RouterCopySourceNotAllowed(s *S3Conf) error {
|
||||
})
|
||||
}
|
||||
|
||||
func RouterListVersionsWithKey(s *S3Conf) error {
|
||||
testName := "RouterListVersionsWithKey"
|
||||
return actionHandlerNoSetup(s, testName, func(s3client *s3.Client, bucket string) error {
|
||||
req, err := http.NewRequest(http.MethodGet, s.endpoint+"/bucket/object?versions", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resp, err := s.httpClient.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return checkHTTPResponseApiErr(resp, s3err.GetAPIError(s3err.ErrVersionsWithKey))
|
||||
})
|
||||
}
|
||||
|
||||
// CORS middleware tests
|
||||
func CORSMiddleware_invalid_method(s *S3Conf) error {
|
||||
testName := "CORSMiddleware_invalid_method"
|
||||
|
||||
@@ -1092,6 +1092,7 @@ func TestRouter(ts *TestState) {
|
||||
ts.Run(RouterPUTObjectOnlyUploadId)
|
||||
ts.Run(RouterGetUploadsWithKey)
|
||||
ts.Run(RouterCopySourceNotAllowed)
|
||||
ts.Run(RouterListVersionsWithKey)
|
||||
}
|
||||
|
||||
func TestUnsignedStreaminPayloadTrailer(ts *TestState) {
|
||||
@@ -1773,6 +1774,7 @@ func GetIntTests() IntTests {
|
||||
"RouterPUTObjectOnlyUploadId": RouterPUTObjectOnlyUploadId,
|
||||
"RouterGetUploadsWithKey": RouterGetUploadsWithKey,
|
||||
"RouterCopySourceNotAllowed": RouterCopySourceNotAllowed,
|
||||
"RouterListVersionsWithKey": RouterListVersionsWithKey,
|
||||
"UnsignedStreaminPayloadTrailer_malformed_trailer": UnsignedStreaminPayloadTrailer_malformed_trailer,
|
||||
"UnsignedStreamingPayloadTrailer_missing_invalid_dec_content_length": UnsignedStreamingPayloadTrailer_missing_invalid_dec_content_length,
|
||||
"UnsignedStreamingPayloadTrailer_invalid_trailing_checksum": UnsignedStreamingPayloadTrailer_invalid_trailing_checksum,
|
||||
|
||||
Reference in New Issue
Block a user