API: add writePartTooSmallErrorResponse to extend standard error responses. (#2005)

This function is added to extend the standard error responses.
Which is needed in some cases for example CompleteMultipartUpload
should respond with ErrPartTooSmall error when parts uploaded are
lesser than 5MB (i.e minimum allowed size per part).

Fixes #1536
This commit is contained in:
Harshavardhana
2016-06-28 14:51:49 -07:00
committed by GitHub
parent 6dcfa7b046
commit 748dc80047
8 changed files with 188 additions and 7 deletions

View File

@@ -594,7 +594,11 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload
// All parts except the last part has to be atleast 5MB.
if (i < len(parts)-1) && !isMinAllowedPartSize(currentXLMeta.Parts[partIdx].Size) {
return "", PartTooSmall{}
return "", PartTooSmall{
PartNumber: part.PartNumber,
PartSize: currentXLMeta.Parts[partIdx].Size,
PartETag: part.ETag,
}
}
// Last part could have been uploaded as 0bytes, do not need