Do not crash in gcs if remote path has zero objects
This commit is contained in:
@@ -145,6 +145,7 @@ async function copy(apiConfig, oldFilePath, newFilePath, progressCallback) {
|
||||
let marker = null;
|
||||
while (true) {
|
||||
const batch = await listDir(apiConfig, oldFilePath, batchSize, marker);
|
||||
if (batch.entries.length === 0) break;
|
||||
total += batch.entries.length;
|
||||
progressCallback({ message: `Copying ${batch.entries.length} files from ${batch.entries[0].fullPath} to ${batch.entries[batch.entries.length-1].fullPath}. total: ${total}` });
|
||||
await async.eachLimit(batch.entries, concurrency, copyFile);
|
||||
@@ -173,6 +174,7 @@ async function removeDir(apiConfig, pathPrefix, progressCallback) {
|
||||
let marker = null;
|
||||
while (true) {
|
||||
const batch = await listDir(apiConfig, pathPrefix, batchSize, marker);
|
||||
if (batch.entries.length === 0) break;
|
||||
const entries = batch.entries;
|
||||
total += entries.length;
|
||||
progressCallback({ message: `Removing ${entries.length} files from ${entries[0].fullPath} to ${entries[entries.length-1].fullPath}. total: ${total}` });
|
||||
|
||||
Reference in New Issue
Block a user