XL/fs: ListMultipartUploads should list only requested entries. (#1668)

Fixes #1665
master
Harshavardhana 9 years ago
parent 3c1ef3fee2
commit 404364ba73
  1. 14
      object-common-multipart.go

@ -373,6 +373,12 @@ func listMetaBucketMultipartFiles(layer ObjectLayer, prefixPath string, markerPa
} }
fileInfo.Name = path.Join(fi.Name, entry) fileInfo.Name = path.Join(fi.Name, entry)
fileInfos = append(fileInfos, fileInfo) 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 { } else {
// We reach here for a non-recursive case non-leaf entry // We reach here for a non-recursive case non-leaf entry
@ -385,7 +391,6 @@ func listMetaBucketMultipartFiles(layer ObjectLayer, prefixPath string, markerPa
fi.Name = path.Dir(fi.Name) fi.Name = path.Dir(fi.Name)
} }
fileInfos = append(fileInfos, fi) fileInfos = append(fileInfos, fi)
}
newMaxKeys++ newMaxKeys++
// If we have reached the maxKeys, it means we have listed // If we have reached the maxKeys, it means we have listed
// everything that was requested. Return right here. // everything that was requested. Return right here.
@ -393,11 +398,18 @@ func listMetaBucketMultipartFiles(layer ObjectLayer, prefixPath string, markerPa
return return
} }
} }
}
// Return entries here. // Return entries here.
return fileInfos, eof, nil 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 // listMultipartUploadsCommon - lists all multipart uploads, common
// function for both object layers. // function for both object layers.
func listMultipartUploadsCommon(layer ObjectLayer, bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) (ListMultipartsInfo, error) { func listMultipartUploadsCommon(layer ObjectLayer, bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) (ListMultipartsInfo, error) {

Loading…
Cancel
Save