Upcloud S3 does not return a Contents property if no keys are found
This commit is contained in:
+2
-2
@@ -221,7 +221,7 @@ async function exists(apiConfig, backupFilePath) {
|
||||
const [error, listData] = await safe(s3.listObjectsV2(listParams));
|
||||
if (error) throw new BoxError(BoxError.EXTERNAL_ERROR, `Error listing objects ${backupFilePath}. ${formatError(error)}`);
|
||||
|
||||
return listData.Contents.length !== 0;
|
||||
return listData.KeyCount !== 0 || listData.Contents.length !== 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ async function listDir(apiConfig, dir, batchSize, marker) {
|
||||
|
||||
const [error, listData] = await safe(s3.listObjectsV2(listParams));
|
||||
if (error) throw new BoxError(BoxError.EXTERNAL_ERROR, `Error listing objects in ${dir}. ${formatError(error)}`);
|
||||
if (listData.Contents.length === 0) return { entries: [], marker: null }; // no more
|
||||
if (listData.KeyCount === 0 || listData.Contents.length === 0) return { entries: [], marker: null }; // no more
|
||||
const entries = listData.Contents.map(function (c) { return { fullPath: c.Key, size: c.Size }; });
|
||||
return { entries, marker: !listData.IsTruncated ? null : listData.NextContinuationToken };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user