fix(#399): loading environment with empty secret variable fails

This commit is contained in:
Michał Szymborski 2023-10-05 19:38:17 +02:00
parent 4e4130acf5
commit a71afc8f73

View File

@ -103,7 +103,7 @@ const addEnvironmentFile = async (win, pathname, collectionUid, collectionPath)
const envSecrets = environmentSecretsStore.getEnvSecrets(collectionPath, file.data);
_.each(envSecrets, (secret) => {
const variable = _.find(file.data.variables, (v) => v.name === secret.name);
if (variable) {
if (variable && secret.value) {
variable.value = decryptString(secret.value);
}
});
@ -137,7 +137,7 @@ const changeEnvironmentFile = async (win, pathname, collectionUid, collectionPat
const envSecrets = environmentSecretsStore.getEnvSecrets(collectionPath, file.data);
_.each(envSecrets, (secret) => {
const variable = _.find(file.data.variables, (v) => v.name === secret.name);
if (variable) {
if (variable && secret.value) {
variable.value = decryptString(secret.value);
}
});