From 3a5f6805cf556504d028abfefcfd7bd27f0dd6ea Mon Sep 17 00:00:00 2001 From: Andrew Rosiclair Date: Fri, 18 Nov 2022 16:38:46 -0500 Subject: [PATCH] wrap lodashGet with an additional trim() call --- src/CONFIG.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CONFIG.js b/src/CONFIG.js index 57260b676e79..9b7648916da0 100644 --- a/src/CONFIG.js +++ b/src/CONFIG.js @@ -1,10 +1,14 @@ -import lodashGet from 'lodash/get'; +import get from 'lodash/get'; import {Platform} from 'react-native'; import Config from 'react-native-config'; import getPlatform from './libs/getPlatform/index'; import * as Url from './libs/Url'; import CONST from './CONST'; +// react-native-config doesn't trim whitespace on iOS for some reason so we +// add a trim() call to lodashGet here to prevent headaches +const lodashGet = (config, key, defaultValue) => get(config, key, defaultValue).trim(); + // Set default values to contributor friendly values to make development work out of the box without an .env file const ENVIRONMENT = lodashGet(Config, 'ENVIRONMENT', CONST.ENVIRONMENT.DEV); const newExpensifyURL = Url.addTrailingForwardSlash(lodashGet(Config, 'NEW_EXPENSIFY_URL', 'https://new.expensify.com/'));