Merge pull request #400 from lared/bug/env-with-empty-secret-variable

fix(#399): loading environment with empty secret variable fails
This commit is contained in:
Anoop M D 2023-10-06 04:11:57 +05:30 committed by GitHub
commit a204e3814b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);
}
});