diff --git a/rest/src/plugins/namespace/namespaceUtils.js b/rest/src/plugins/namespace/namespaceUtils.js index 3879cdc62..c5e6bf45e 100644 --- a/rest/src/plugins/namespace/namespaceUtils.js +++ b/rest/src/plugins/namespace/namespaceUtils.js @@ -85,7 +85,8 @@ const namespaceUtils = { aliasName += `.${uniqueTransactions.find(t => t.namespaceId.equals(n.namespace.level1)).name}`; if (3 <= n.namespace.depth) aliasName += `.${uniqueTransactions.find(t => t.namespaceId.equals(n.namespace.level2)).name}`; - names.push(aliasName); + if (-1 === names.indexOf(aliasName)) + names.push(aliasName); }); return { [aliasFieldName]: id, names }; }); diff --git a/rest/test/plugins/namespace/namespaceUtils_spec.js b/rest/test/plugins/namespace/namespaceUtils_spec.js index 096c6ff31..edcff4b88 100644 --- a/rest/test/plugins/namespace/namespaceUtils_spec.js +++ b/rest/test/plugins/namespace/namespaceUtils_spec.js @@ -60,6 +60,8 @@ describe('namespace utils', () => { }); const registerNamespaceTransactionsFromNamespaceIdsFake = sinon.fake(() => { const transactions = [ + createRegisterNamespaceTransaction(12345, 1, 1, 'a'), + createRegisterNamespaceTransaction(33437, 1, 1, 'a'), createRegisterNamespaceTransaction(12345, 1, 1, 'a'), createRegisterNamespaceTransaction(67891, 1, 1, 'b'), createRegisterNamespaceTransaction(38467, 1, 1, 'c'),