mirror of
https://github.com/versity/versitygw.git
synced 2026-01-07 12:15:18 +00:00
feat: adds copy source validation for x-amz-copy-source header.
Fixes #1388 Fixes #1389 Fixes #1390 Fixes #1401 Adds the `x-amz-copy-source` header validation for `CopyObject` and `UploadPartCopy` in front-end. The error: ``` ErrInvalidCopySource: { Code: "InvalidArgument", Description: "Copy Source must mention the source bucket and key: sourcebucket/sourcekey.", HTTPStatusCode: http.StatusBadRequest, }, ``` is now deprecated. The conditional read/write headers validation in `CopyObject` should come with #821 and #822.
This commit is contained in:
@@ -87,8 +87,10 @@ const (
|
||||
ErrInvalidCompleteMpPartNumber
|
||||
ErrInternalError
|
||||
ErrInvalidCopyDest
|
||||
ErrInvalidCopySource
|
||||
ErrInvalidCopySourceRange
|
||||
ErrInvalidCopySourceBucket
|
||||
ErrInvalidCopySourceObject
|
||||
ErrInvalidCopySourceEncoding
|
||||
ErrInvalidTagKey
|
||||
ErrInvalidTagValue
|
||||
ErrDuplicateTagKey
|
||||
@@ -333,16 +335,26 @@ var errorCodeResponse = map[ErrorCode]APIError{
|
||||
Description: "This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes.",
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
},
|
||||
ErrInvalidCopySource: {
|
||||
Code: "InvalidArgument",
|
||||
Description: "Copy Source must mention the source bucket and key: sourcebucket/sourcekey.",
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
},
|
||||
ErrInvalidCopySourceRange: {
|
||||
Code: "InvalidArgument",
|
||||
Description: "The x-amz-copy-source-range value must be of the form bytes=first-last where first and last are the zero-based offsets of the first and last bytes to copy",
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
},
|
||||
ErrInvalidCopySourceBucket: {
|
||||
Code: "InvalidArgument",
|
||||
Description: "Invalid copy source bucket name",
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
},
|
||||
ErrInvalidCopySourceObject: {
|
||||
Code: "InvalidArgument",
|
||||
Description: "Invalid copy source object key",
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
},
|
||||
ErrInvalidCopySourceEncoding: {
|
||||
Code: "InvalidArgument",
|
||||
Description: "Invalid copy source encoding",
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
},
|
||||
ErrInvalidTagKey: {
|
||||
Code: "InvalidTag",
|
||||
Description: "The TagKey you have provided is invalid",
|
||||
|
||||
Reference in New Issue
Block a user