From 1f541ffcdb88d4a6fdb92a116863e989c1c5f4cf Mon Sep 17 00:00:00 2001 From: Matthew Irish Date: Wed, 9 Jan 2019 20:41:12 -0600 Subject: [PATCH] only look for data.keys if it's not a queryRecord request on secrets --- ui/app/serializers/secret.js | 2 +- ui/tests/acceptance/secrets/backend/kv/secret-test.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/app/serializers/secret.js b/ui/app/serializers/secret.js index 6b6bb68e62a2..7be158bf4498 100644 --- a/ui/app/serializers/secret.js +++ b/ui/app/serializers/secret.js @@ -4,7 +4,7 @@ import ApplicationSerializer from './application'; export default ApplicationSerializer.extend({ secretDataPath: 'data', normalizeItems(payload, requestType) { - if (payload.data.keys && Array.isArray(payload.data.keys)) { + if (requestType !== 'queryRecord' && payload.data.keys && Array.isArray(payload.data.keys)) { // if we have data.keys, it's a list of ids, so we map over that // and create objects with id's return payload.data.keys.map(secret => { diff --git a/ui/tests/acceptance/secrets/backend/kv/secret-test.js b/ui/tests/acceptance/secrets/backend/kv/secret-test.js index 3373166552fc..9dd06e536d1c 100644 --- a/ui/tests/acceptance/secrets/backend/kv/secret-test.js +++ b/ui/tests/acceptance/secrets/backend/kv/secret-test.js @@ -138,6 +138,17 @@ module('Acceptance | secrets/secret/create', function(hooks) { ); }); + // https://github.com/hashicorp/vault/issues/5994 + test('version 1: key named keys', async function(assert) { + await consoleComponent.runCommands([ + 'vault write sys/mounts/test type=kv', + 'refresh', + 'vault write test/a keys=a keys=b', + ]); + await showPage.visit({ backend: 'test', id: 'a' }); + assert.ok(showPage.editIsPresent, 'renders the page properly'); + }); + test('it redirects to the path ending in / for list pages', async function(assert) { const path = `foo/bar/kv-path-${new Date().getTime()}`; await listPage.visitRoot({ backend: 'secret' });