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:
niksis02
2026-01-03 16:23:11 +04:00
parent f235b62b70
commit c2c2306d37
4 changed files with 31 additions and 0 deletions

View File

@@ -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"

View File

@@ -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,