Skip to content

Commit a681d7f

Browse files
committed
fix: Bug fix for files that don't currently exist. Import confirmation prompt
1 parent 7604bf2 commit a681d7f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/orchestrators/import.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,17 @@ export class ImportOrchestrator {
286286
continue;
287287
}
288288

289-
const hash = await ApiClient.getRemoteFileHash(file.parameters.remote as string, credentials);
289+
let hash: string
290+
try {
291+
hash = await ApiClient.getRemoteFileHash(file.parameters.remote as string, credentials);
292+
} catch {
293+
hash = '';
294+
}
295+
296+
if (hash && hash !== '' && file.parameters.onlyCreate) {
297+
continue;
298+
}
299+
290300
if (hash !== file.parameters.hash) {
291301
filesToUpdate.push(file);
292302
}
@@ -296,9 +306,9 @@ export class ImportOrchestrator {
296306
return;
297307
}
298308

299-
const fileNames = filesToUpdate.map((f) => `'${f.parameters.path}'`).join(', ')
309+
const fileNames = filesToUpdate.map((f, idx) => `${idx + 1}. ${f.parameters.path} -> ${f.parameters.remote}`).join(',\n');
300310
const shouldUpdate = await reporter.promptConfirmation(
301-
`The following files have been updated: [${fileNames}].\nDo you want to upload the changes to Codify cloud? ${chalk.bold('(Warning this will override any existing data!)')}`,
311+
`The following files have been updated:\n${fileNames}\n\nDo you want to upload the changes to Codify cloud? ${chalk.bold('(Warning this will override any existing data!)')}`,
302312
);
303313

304314
if (!shouldUpdate) {

0 commit comments

Comments
 (0)