fix: preserve committed backup creation success

This commit is contained in:
Sucukdeluxe
2026-08-22 10:46:23 +02:00
parent 6fc516433f
commit 2bfa153136
2 changed files with 30 additions and 6 deletions
+9 -4
View File
@@ -20,6 +20,14 @@ function sanitizeEntry(entry) {
};
}
function sanitizeCreatedEntry(entry, key) {
return {
id: entry.id,
displayKey: `${key.slice(0, 9)}${key.slice(-4)}`,
createdAt: entry.createdAt
};
}
function createOnlineBackupManager({
keyring,
loadSettings,
@@ -56,10 +64,7 @@ function createOnlineBackupManager({
} catch {}
throw error;
}
const entries = await listEntries();
const entry = entries.find((current) => current.id === prepared.id);
if (!entry) throw new Error(ERRORS.create);
return { ok: true, entry };
return { ok: true, entry: sanitizeCreatedEntry(prepared, created.key) };
}
async function deleteTransaction(id) {