From 0ad0af041b066b8ea57729ec81a42a6a012c6f7b Mon Sep 17 00:00:00 2001 From: lohxt1 Date: Mon, 16 Dec 2024 18:46:16 +0530 Subject: [PATCH 1/3] fix: validations updates --- packages/bruno-app/src/utils/collections/index.js | 4 ++-- packages/bruno-app/src/utils/common/index.js | 2 +- packages/bruno-app/src/utils/importers/common.js | 4 ++-- packages/bruno-electron/src/store/global-environments.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/bruno-app/src/utils/collections/index.js b/packages/bruno-app/src/utils/collections/index.js index 3a691e53..e28bc0d1 100644 --- a/packages/bruno-app/src/utils/collections/index.js +++ b/packages/bruno-app/src/utils/collections/index.js @@ -797,8 +797,8 @@ export const getGlobalEnvironmentVariables = ({ globalEnvironments, activeGlobal const environment = globalEnvironments?.find(env => env?.uid === activeGlobalEnvironmentUid); if (environment) { each(environment.variables, (variable) => { - if (variable.name && variable.value && variable.enabled) { - variables[variable.name] = variable.value; + if (variable.name && variable.enabled) { + variables[variable.name] = variable.value || ''; } }); } diff --git a/packages/bruno-app/src/utils/common/index.js b/packages/bruno-app/src/utils/common/index.js index 1244966b..10ca09e5 100644 --- a/packages/bruno-app/src/utils/common/index.js +++ b/packages/bruno-app/src/utils/common/index.js @@ -173,4 +173,4 @@ export const generateUidBasedOnHash = (str) => { return `${hash}`.padEnd(21, '0'); }; -export const stringifyIfNot = v => typeof v === 'string' ? v : String(v); +export const stringifyIfNot = v => typeof v === 'string' ? v : ''; diff --git a/packages/bruno-app/src/utils/importers/common.js b/packages/bruno-app/src/utils/importers/common.js index c9904841..88c4c787 100644 --- a/packages/bruno-app/src/utils/importers/common.js +++ b/packages/bruno-app/src/utils/importers/common.js @@ -79,9 +79,9 @@ export const transformItemsInCollection = (collection) => { // from 5 feb 2024, multipartFormData needs to have a type // this was introduced when we added support for file uploads // below logic is to make older collection exports backward compatible - let multipartFormData = _.get(item, 'request.body.multipartForm'); + let multipartFormData = get(item, 'request.body.multipartForm'); if (multipartFormData) { - _.each(multipartFormData, (form) => { + each(multipartFormData, (form) => { if (!form.type) { form.type = 'text'; } diff --git a/packages/bruno-electron/src/store/global-environments.js b/packages/bruno-electron/src/store/global-environments.js index e8c03c43..2f9c1b30 100644 --- a/packages/bruno-electron/src/store/global-environments.js +++ b/packages/bruno-electron/src/store/global-environments.js @@ -18,7 +18,7 @@ class GlobalEnvironmentsStore { return globalEnvironments?.map(env => { const variables = env.variables?.map(v => ({ ...v, - value: v?.secret ? (this.isValidValue(v.value) ? encryptString(v.value) : '') : v?.value + value: v?.secret ? (this.isValidValue(v.value) ? encryptString(v.value) : '') : (v?.value || '') })) || []; return { @@ -32,7 +32,7 @@ class GlobalEnvironmentsStore { return globalEnvironments?.map(env => { const variables = env.variables?.map(v => ({ ...v, - value: v?.secret ? (this.isValidValue(v.value) ? decryptString(v.value) : '') : v?.value + value: v?.secret ? (this.isValidValue(v.value) ? decryptString(v.value) : '') : (v?.value || '') })) || []; return { From 7a8d1624d1c24e9a30369f41d747098a874778c5 Mon Sep 17 00:00:00 2001 From: lohxt1 Date: Mon, 16 Dec 2024 22:09:10 +0530 Subject: [PATCH 2/3] fix: updates --- .../src/providers/ReduxStore/slices/global-environments.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/global-environments.js b/packages/bruno-app/src/providers/ReduxStore/slices/global-environments.js index 77f46912..def88f2b 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/global-environments.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/global-environments.js @@ -191,7 +191,7 @@ export const globalEnvironmentsUpdateEvent = ({ globalEnvironmentVariables }) => // update existing values variables = variables?.map?.(variable => ({ ...variable, - value: stringifyIfNot(globalEnvironmentVariables?.[variable?.name]) + value: globalEnvironmentVariables?.[variable?.name] })); // add new env values @@ -201,7 +201,7 @@ export const globalEnvironmentsUpdateEvent = ({ globalEnvironmentVariables }) => variables.push({ uid: uuid(), name: key, - value: stringifyIfNot(value), + value, type: 'text', secret: false, enabled: true From e44dcad01ae1e70e16529c768e67372ff144178a Mon Sep 17 00:00:00 2001 From: lohxt1 Date: Mon, 16 Dec 2024 22:13:26 +0530 Subject: [PATCH 3/3] fix: updates --- packages/bruno-app/src/utils/collections/index.js | 2 +- packages/bruno-app/src/utils/common/index.js | 2 +- packages/bruno-electron/src/store/global-environments.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/bruno-app/src/utils/collections/index.js b/packages/bruno-app/src/utils/collections/index.js index e28bc0d1..d770c60a 100644 --- a/packages/bruno-app/src/utils/collections/index.js +++ b/packages/bruno-app/src/utils/collections/index.js @@ -798,7 +798,7 @@ export const getGlobalEnvironmentVariables = ({ globalEnvironments, activeGlobal if (environment) { each(environment.variables, (variable) => { if (variable.name && variable.enabled) { - variables[variable.name] = variable.value || ''; + variables[variable.name] = variable.value; } }); } diff --git a/packages/bruno-app/src/utils/common/index.js b/packages/bruno-app/src/utils/common/index.js index 10ca09e5..1244966b 100644 --- a/packages/bruno-app/src/utils/common/index.js +++ b/packages/bruno-app/src/utils/common/index.js @@ -173,4 +173,4 @@ export const generateUidBasedOnHash = (str) => { return `${hash}`.padEnd(21, '0'); }; -export const stringifyIfNot = v => typeof v === 'string' ? v : ''; +export const stringifyIfNot = v => typeof v === 'string' ? v : String(v); diff --git a/packages/bruno-electron/src/store/global-environments.js b/packages/bruno-electron/src/store/global-environments.js index 2f9c1b30..e8c03c43 100644 --- a/packages/bruno-electron/src/store/global-environments.js +++ b/packages/bruno-electron/src/store/global-environments.js @@ -18,7 +18,7 @@ class GlobalEnvironmentsStore { return globalEnvironments?.map(env => { const variables = env.variables?.map(v => ({ ...v, - value: v?.secret ? (this.isValidValue(v.value) ? encryptString(v.value) : '') : (v?.value || '') + value: v?.secret ? (this.isValidValue(v.value) ? encryptString(v.value) : '') : v?.value })) || []; return { @@ -32,7 +32,7 @@ class GlobalEnvironmentsStore { return globalEnvironments?.map(env => { const variables = env.variables?.map(v => ({ ...v, - value: v?.secret ? (this.isValidValue(v.value) ? decryptString(v.value) : '') : (v?.value || '') + value: v?.secret ? (this.isValidValue(v.value) ? decryptString(v.value) : '') : v?.value })) || []; return {