mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
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.
This commit is contained in:
1 parent
0feeb2a627
commit
e10ae018bf
1 file changed
+6
-6
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user