From db56fcc3f3f080cc4a915600b092ccdb75962c54 Mon Sep 17 00:00:00 2001 From: mixeme Date: Fri, 7 Aug 2026 22:11:55 +0300 Subject: [PATCH] fix(panel): keep the import password field hidden until a file is chosen The field was revealed whenever no file was selected, so the import card opened asking for a password it had no use for yet. Hide it in that case too; an unrecognised extension still reveals it. Co-Authored-By: Claude Sonnet 5 --- internal/web/static/panel.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/web/static/panel.js b/internal/web/static/panel.js index 0f0c453..c85df0d 100644 --- a/internal/web/static/panel.js +++ b/internal/web/static/panel.js @@ -106,8 +106,10 @@ // The domain-import file decides for itself whether it is encrypted (the // server checks the envelope magic, not a checkbox), so the panel offers // the password field the same way: reveal it for a .spde file, hide and - // clear it for a plain .json one. An unrecognised name leaves the field - // visible rather than guessing wrong and hiding a password the file needs. + // clear it for a plain .json one. With no file chosen yet there is nothing + // to ask a password for, so the field stays hidden until a file names it. + // An unrecognised name leaves the field visible rather than guessing wrong + // and hiding a password the file needs. function syncImportPasswordField(input) { var form = input.closest("form"); var fields = form && form.querySelector("[data-import-password-fields]"); @@ -115,7 +117,7 @@ return; } var name = (input.files && input.files[0] && input.files[0].name || "").toLowerCase(); - var hide = name !== "" && /\.json$/.test(name); + var hide = name === "" || /\.json$/.test(name); fields.hidden = hide; if (hide) { fields.querySelectorAll("input").forEach(function (pw) {