Multipart: Minimum part size limit does not apply to the last part during CompleteMultipartUpload. (#1518) (#1538)

This commit is contained in:
Krishna Srinivas
2016-05-09 12:19:49 +05:30
committed by Harshavardhana
parent 90ea494338
commit 04a5b25929
4 changed files with 36 additions and 6 deletions

View File

@@ -124,7 +124,7 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload
var wg = &sync.WaitGroup{}
// Loop through all parts, validate them and then commit to disk.
for _, part := range parts {
for i, part := range parts {
// Construct part suffix.
partSuffix := fmt.Sprintf("%.5d.%s", part.PartNumber, part.ETag)
multipartPartFile := path.Join(mpartMetaPrefix, bucket, object, uploadID, partSuffix)
@@ -136,7 +136,8 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload
}
return "", err
}
if !isMinAllowedPartSize(fi.Size) {
// All parts except the last part has to be atleast 5MB.
if (i < len(parts)-1) && !isMinAllowedPartSize(fi.Size) {
return "", PartTooSmall{}
}
// Update metadata parts.