diff --git a/cmd/api-errors.go b/cmd/api-errors.go index a14a20cc1..2615b0f31 100644 --- a/cmd/api-errors.go +++ b/cmd/api-errors.go @@ -2097,6 +2097,8 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) { apiErr = ErrObjectLockInvalidHeaders case objectlock.ErrMalformedXML: apiErr = ErrMalformedXML + case errInvalidMaxParts: + apiErr = ErrInvalidMaxParts } // Compression errors diff --git a/cmd/object-api-options.go b/cmd/object-api-options.go index f3cb9de58..ec29ea1c9 100644 --- a/cmd/object-api-options.go +++ b/cmd/object-api-options.go @@ -89,6 +89,9 @@ func getOpts(ctx context.Context, r *http.Request, bucket, object string) (Objec if err != nil { return opts, err } + if isMaxPartID(partNumber) { + return opts, errInvalidMaxParts + } if partNumber <= 0 { return opts, errInvalidArgument } diff --git a/cmd/typed-errors.go b/cmd/typed-errors.go index 8b8085136..c125d47f8 100644 --- a/cmd/typed-errors.go +++ b/cmd/typed-errors.go @@ -112,3 +112,6 @@ var errIAMNotInitialized = errors.New("IAM sub-system is being initialized, plea // error returned when upload id not found var errUploadIDNotFound = errors.New("Specified Upload ID is not found") + +// error returned when PartNumber is greater than the maximum allowed 10000 parts +var errInvalidMaxParts = errors.New("Part number is greater than the maximum allowed 10000 parts")