mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
For missing parts reply back as InvalidPart{}
This commit is contained in:
parent
fdee527a4d
commit
7ae60a6d10
@ -335,6 +335,13 @@ func (e MissingDateHeader) Error() string {
|
|||||||
return "Missing date header"
|
return "Missing date header"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InvalidPart One or more of the specified parts could not be found
|
||||||
|
type InvalidPart struct{}
|
||||||
|
|
||||||
|
func (e InvalidPart) Error() string {
|
||||||
|
return "One or more of the specified parts could not be found"
|
||||||
|
}
|
||||||
|
|
||||||
// InvalidPartOrder parts are not ordered as Requested
|
// InvalidPartOrder parts are not ordered as Requested
|
||||||
type InvalidPartOrder struct {
|
type InvalidPartOrder struct {
|
||||||
UploadID string
|
UploadID string
|
||||||
|
@ -286,7 +286,7 @@ func (donut API) CompleteMultipartUpload(bucket, key, uploadID string, data io.R
|
|||||||
object, ok := donut.multiPartObjects[uploadID].Get(parts.Part[i].PartNumber)
|
object, ok := donut.multiPartObjects[uploadID].Get(parts.Part[i].PartNumber)
|
||||||
if ok == false {
|
if ok == false {
|
||||||
donut.lock.Unlock()
|
donut.lock.Unlock()
|
||||||
return ObjectMetadata{}, iodine.New(errors.New("missing part: "+strconv.Itoa(parts.Part[i].PartNumber)), nil)
|
return ObjectMetadata{}, iodine.New(InvalidPart{}, nil)
|
||||||
}
|
}
|
||||||
size += int64(len(object))
|
size += int64(len(object))
|
||||||
calcMD5Bytes := md5.Sum(object)
|
calcMD5Bytes := md5.Sum(object)
|
||||||
|
@ -558,6 +558,8 @@ func (api Minio) CompleteMultipartUploadHandler(w http.ResponseWriter, req *http
|
|||||||
}
|
}
|
||||||
case donut.InvalidUploadID:
|
case donut.InvalidUploadID:
|
||||||
writeErrorResponse(w, req, NoSuchUpload, acceptsContentType, req.URL.Path)
|
writeErrorResponse(w, req, NoSuchUpload, acceptsContentType, req.URL.Path)
|
||||||
|
case donut.InvalidPart:
|
||||||
|
writeErrorResponse(w, req, InvalidPart, acceptsContentType, req.URL.Path)
|
||||||
case donut.InvalidPartOrder:
|
case donut.InvalidPartOrder:
|
||||||
writeErrorResponse(w, req, InvalidPartOrder, acceptsContentType, req.URL.Path)
|
writeErrorResponse(w, req, InvalidPartOrder, acceptsContentType, req.URL.Path)
|
||||||
case donut.MissingDateHeader:
|
case donut.MissingDateHeader:
|
||||||
|
Loading…
Reference in New Issue
Block a user