diff --git a/object-common-multipart.go b/object-common-multipart.go index 3d4ed51ba..673221fb6 100644 --- a/object-common-multipart.go +++ b/object-common-multipart.go @@ -373,6 +373,12 @@ func listMetaBucketMultipartFiles(layer ObjectLayer, prefixPath string, markerPa } fileInfo.Name = path.Join(fi.Name, entry) fileInfos = append(fileInfos, fileInfo) + newMaxKeys++ + // If we have reached the maxKeys, it means we have listed + // everything that was requested. Return right here. + if newMaxKeys == maxKeys { + return + } } } else { // We reach here for a non-recursive case non-leaf entry @@ -385,12 +391,12 @@ func listMetaBucketMultipartFiles(layer ObjectLayer, prefixPath string, markerPa fi.Name = path.Dir(fi.Name) } fileInfos = append(fileInfos, fi) - } - newMaxKeys++ - // If we have reached the maxKeys, it means we have listed - // everything that was requested. Return right here. - if newMaxKeys == maxKeys { - return + newMaxKeys++ + // If we have reached the maxKeys, it means we have listed + // everything that was requested. Return right here. + if newMaxKeys == maxKeys { + return + } } } @@ -398,6 +404,12 @@ func listMetaBucketMultipartFiles(layer ObjectLayer, prefixPath string, markerPa return fileInfos, eof, nil } +// FIXME: Currently the code sorts based on keyName/upload-id which is +// in correct based on the S3 specs. According to s3 specs we are +// supposed to only lexically sort keyNames and then for keyNames with +// multiple upload ids should be sorted based on the initiated time. +// Currently this case is not handled. + // listMultipartUploadsCommon - lists all multipart uploads, common // function for both object layers. func listMultipartUploadsCommon(layer ObjectLayer, bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) (ListMultipartsInfo, error) {