From e10ae018bf204e1c25fb2d700333b136dd1dac20 Mon Sep 17 00:00:00 2001 From: Levi van Noort <73097785+levivannoort@users.noreply.github.com> Date: Thu, 13 Aug 2026 08:50:46 +0200 Subject: [PATCH] fix(variables): filter valueless entries before validating an import An entry with an empty value is discarded rather than written, so an invalid key on one of them was rejecting the whole file and taking the valid variables down with it. --- .../components/variables/importVariablesModal.svelte | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/components/variables/importVariablesModal.svelte b/src/lib/components/variables/importVariablesModal.svelte index 8ff09d62a..9eed108b2 100644 --- a/src/lib/components/variables/importVariablesModal.svelte +++ b/src/lib/components/variables/importVariablesModal.svelte @@ -36,7 +36,9 @@ if (!Object.keys(uploaded).length) { throw new Error('No variables found'); } - const entries = Object.entries(uploaded); + // Drop the valueless entries first. They are never written, so an + // invalid key on one of them must not reject the whole file. + const entries = Object.entries(uploaded).filter(([, value]) => !!value); const validationError = validateVariables( entries.map(([key, value]) => ({ key, value })) @@ -45,11 +47,9 @@ throw new Error(validationError); } - entries - .filter(([, value]) => !!value) - .forEach(([key, value]) => { - variables.push({ key, value, secret }); - }); + entries.forEach(([key, value]) => { + variables.push({ key, value, secret }); + }); show = false; } catch (e) {