diff --git a/addons/api/addon/utils/flatten-nested-object.js b/addons/api/addon/utils/flatten-nested-object.js index 5b62befcc..b73a18422 100644 --- a/addons/api/addon/utils/flatten-nested-object.js +++ b/addons/api/addon/utils/flatten-nested-object.js @@ -18,8 +18,8 @@ export const flattenObject = (obj, result = {}, parentKey = '') => { if (typeOf(obj[key]) === 'object' && obj[key] !== null) { // Recursively flatten the object flattenObject(obj[key], result, `${parentKey}${key}.`); - } else if (obj[key]) { - // Only add to result if the value is not null + } else if (obj[key] !== null && obj[key] !== '') { + // Only add to result if the value is not null or an empty string result[`${parentKey}${key}`] = obj[key]; } } diff --git a/addons/api/tests/unit/utils/flatten-nested-object-test.js b/addons/api/tests/unit/utils/flatten-nested-object-test.js index 0a5b00b5d..ad69f0163 100644 --- a/addons/api/tests/unit/utils/flatten-nested-object-test.js +++ b/addons/api/tests/unit/utils/flatten-nested-object-test.js @@ -28,12 +28,16 @@ module('Unit | Utility | flatten-nested-object', function () { d: { e: { f: { g: { h: '' } } }, }, + i: 0, + j: false, }; const inputTwo = { d: { e: null }, }; const expectedResultOne = { 'b.c': 2, + i: 0, + j: false, }; const expectedResultTwo = {}; diff --git a/ui/desktop/app/components/hidden-secret/index.js b/ui/desktop/app/components/hidden-secret/index.js index 42310a53c..257858661 100644 --- a/ui/desktop/app/components/hidden-secret/index.js +++ b/ui/desktop/app/components/hidden-secret/index.js @@ -16,7 +16,7 @@ export default class HiddenSecretComponent extends Component { if (typeof this.args.secret === 'object' && this.args.secret !== null) { return JSON.stringify(this.args.secret, null, 2); } else { - return this.args.secret; + return this.args.secret.toString(); } }