fix: adds error routes to reject x-amz-copy-source for GET, POST, HEAD, DELETErequests

Fixes #1612

`x-amz-copy-source` is rejected with an **InvalidArgument** error in S3 for all HTTP methods other than **PUT** (i.e., **GET**, **POST**, **HEAD**, and **DELETE**). For **POST** requests, the behavior is slightly different: the error is returned only when the **uploadId** query parameter is present; otherwise, **MethodNotAllowed** is returned. This behavior applies to both bucket-level and object-level operations.
This commit is contained in:
niksis02
2025-11-13 20:49:40 +04:00
parent 9f54a25519
commit 4740372ce2
4 changed files with 115 additions and 0 deletions

View File

@@ -1087,6 +1087,7 @@ func TestRouter(ts *TestState) {
ts.Run(RouterPostObjectWithoutQuery)
ts.Run(RouterPUTObjectOnlyUploadId)
ts.Run(RouterGetUploadsWithKey)
ts.Run(RouterCopySourceNotAllowed)
}
type IntTest func(s3 *S3Conf) error
@@ -1724,5 +1725,6 @@ func GetIntTests() IntTests {
"RouterPostObjectWithoutQuery": RouterPostObjectWithoutQuery,
"RouterPUTObjectOnlyUploadId": RouterPUTObjectOnlyUploadId,
"RouterGetUploadsWithKey": RouterGetUploadsWithKey,
"RouterCopySourceNotAllowed": RouterCopySourceNotAllowed,
}
}