mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Merge pull request #2840 from kmlebedev/fix_multi_object_delete_key_limit
fix test_s3.test_multi_object_delete_key_limit and test_multi_objectv2_delete_key_limit
This commit is contained in:
commit
ce8ef60c59
|
@ -27,6 +27,10 @@ import (
|
|||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
const (
|
||||
deleteMultipleObjectsLimmit = 1000
|
||||
)
|
||||
|
||||
func mimeDetect(r *http.Request, dataReader io.Reader) io.ReadCloser {
|
||||
mimeBuffer := make([]byte, 512)
|
||||
size, _ := dataReader.Read(mimeBuffer)
|
||||
|
@ -217,6 +221,11 @@ func (s3a *S3ApiServer) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *h
|
|||
return
|
||||
}
|
||||
|
||||
if len(deleteObjects.Objects) > deleteMultipleObjectsLimmit {
|
||||
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidMaxDeleteObjects)
|
||||
return
|
||||
}
|
||||
|
||||
var deletedObjects []ObjectIdentifier
|
||||
var deleteErrors []DeleteError
|
||||
var auditLog *s3err.AccessLog
|
||||
|
|
|
@ -61,6 +61,7 @@ const (
|
|||
ErrInvalidMaxKeys
|
||||
ErrInvalidMaxUploads
|
||||
ErrInvalidMaxParts
|
||||
ErrInvalidMaxDeleteObjects
|
||||
ErrInvalidPartNumberMarker
|
||||
ErrInvalidPart
|
||||
ErrInternalError
|
||||
|
@ -157,6 +158,11 @@ var errorCodeResponse = map[ErrorCode]APIError{
|
|||
Description: "Argument max-parts must be an integer between 0 and 2147483647",
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
},
|
||||
ErrInvalidMaxDeleteObjects: {
|
||||
Code: "InvalidArgument",
|
||||
Description: "Argument objects can contain a list of up to 1000 keys",
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
},
|
||||
ErrInvalidPartNumberMarker: {
|
||||
Code: "InvalidArgument",
|
||||
Description: "Argument partNumberMarker must be an integer.",
|
||||
|
|
Loading…
Reference in a new issue