Skip to content

Commit f8c76df

Browse files
authored
Merge pull request #552 from lockdown-systems/fix-551
fix: ensure import from already unzipped folders is not destructive
2 parents 98aaeb6 + 24f04d7 commit f8c76df

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/renderer/src/views/x/XWizardImportingPage.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,26 @@ const startClicked = async () => {
9292
statusValidating.value = ImportStatus.Failed;
9393
errorMessages.value.push(`${e}`);
9494
importFailed.value = true;
95-
await window.electron.X.deleteUnzippedXArchive(props.model.account.id, unzippedPath);
95+
// Only delete the unzipped archive if we extracted it from a ZIP file
96+
if (isZip) {
97+
await window.electron.X.deleteUnzippedXArchive(props.model.account.id, unzippedPath);
98+
}
9699
return;
97100
}
98101
if (verifyResp !== null) {
99102
statusValidating.value = ImportStatus.Failed;
100103
errorMessages.value.push(verifyResp);
101104
importFailed.value = true;
102-
await window.electron.X.deleteUnzippedXArchive(props.model.account.id, unzippedPath);
105+
// Only delete the unzipped archive if we extracted it from a ZIP file
106+
if (isZip) {
107+
await window.electron.X.deleteUnzippedXArchive(props.model.account.id, unzippedPath);
108+
}
103109
return;
104110
}
105111
statusValidating.value = ImportStatus.Finished;
106112
107113
// After unzipping and verifying, if we're in archive-only mode, the unzippedPath has changed
108-
if (props.model.account?.xAccount?.archiveOnly) {
114+
if (props.model.account?.xAccount?.archiveOnly && isZip) {
109115
unzippedPath = await window.electron.getAccountDataPath(props.model.account.id, "tmp");
110116
if (!unzippedPath) {
111117
statusValidating.value = ImportStatus.Failed;

0 commit comments

Comments
 (0)