fix(backup): don't pass click event as legacy password

addEventListener('click', doBackupImport) was passing the MouseEvent
as the first argument, which got forwarded to pbkdf2 as an Object.
This commit is contained in:
Administrator 2026-04-17 16:54:53 +02:00
parent e3c8ccdca4
commit 161357522e

View File

@ -1200,12 +1200,13 @@ function askLegacyBackupPassword() {
}
async function doBackupImport(legacyPassword) {
const pw = typeof legacyPassword === 'string' ? legacyPassword : undefined;
try {
const result = await window.api.importBackup(legacyPassword);
const result = await window.api.importBackup(pw);
if (!result || result.canceled) return;
if (result.needsPassword) {
const pw = await askLegacyBackupPassword();
if (pw) doBackupImport(pw);
const entered = await askLegacyBackupPassword();
if (entered) doBackupImport(entered);
return;
}
if (result.ok) {
@ -2311,8 +2312,8 @@ function renderSettings() {
arrow.innerHTML = isOpen ? '▶' : '▼';
});
document.getElementById('exportBackupBtn').addEventListener('click', doBackupExport);
document.getElementById('importBackupBtn').addEventListener('click', doBackupImport);
document.getElementById('exportBackupBtn').addEventListener('click', () => doBackupExport());
document.getElementById('importBackupBtn').addEventListener('click', () => doBackupImport());
// --- Separator before hoster panels ---
const separator = document.createElement('div');