storage: standardize the listDir API

This commit is contained in:
Girish Ramakrishnan
2018-07-27 14:29:07 -07:00
parent 94cb222869
commit 737541f707
4 changed files with 33 additions and 10 deletions

View File

@@ -197,10 +197,7 @@ function listDir(apiConfig, dir, iteratorCallback, callback) {
async.forever(function listAndDownload(foreverCallback) {
s3.listObjects(listParams, function (error, listData) {
if (error) {
debug('remove: Failed to list %s. Not fatal.', error);
return foreverCallback(error);
}
if (error) return foreverCallback(error);
if (listData.Contents.length === 0) return foreverCallback(new Error('Done'));