diff --git a/changelog/24281.txt b/changelog/24281.txt new file mode 100644 index 000000000000..7d24c296a1f2 --- /dev/null +++ b/changelog/24281.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Correctly handle directory redirects from pre 1.15.0 Kv v2 list view urls. +``` diff --git a/ui/app/components/dashboard/quick-actions-card.js b/ui/app/components/dashboard/quick-actions-card.js index 57a524c3adc8..6247790f757a 100644 --- a/ui/app/components/dashboard/quick-actions-card.js +++ b/ui/app/components/dashboard/quick-actions-card.js @@ -140,7 +140,7 @@ export default class DashboardQuickActionsCard extends Component { @action navigateToPage() { let route = this.searchSelectParams.route; - // If search-select falls back to stringInput, paramVlue is a string not object + // If search-select falls back to stringInput, paramValue is a string not object let param = this.paramValue.id || this.paramValue; // kv has a special use case where if the paramValue ends in a '/' you should diff --git a/ui/app/routes/vault/cluster/secrets/backend/list.js b/ui/app/routes/vault/cluster/secrets/backend/list.js index 85feb1662f79..c1db7504a545 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/list.js +++ b/ui/app/routes/vault/cluster/secrets/backend/list.js @@ -11,6 +11,7 @@ import { allEngines, isAddonEngine } from 'vault/helpers/mountable-secret-engine import { inject as service } from '@ember/service'; import { normalizePath } from 'vault/utils/path-encoding-helpers'; import { assert } from '@ember/debug'; +import { pathIsDirectory } from 'kv/utils/kv-breadcrumbs'; const SUPPORTED_BACKENDS = supportedSecretBackends(); @@ -77,6 +78,9 @@ export default Route.extend({ return this.router.replaceWith('vault.cluster.secrets.backend.list', secret + '/'); } if (isAddonEngine(type, secretEngine.version)) { + if (engineRoute === 'kv.list' && pathIsDirectory(secret)) { + return this.router.transitionTo('vault.cluster.secrets.backend.kv.list-directory', backend, secret); + } return this.router.transitionTo(`vault.cluster.secrets.backend.${engineRoute}`, backend); } const modelType = this.getModelType(backend, tab); diff --git a/ui/tests/acceptance/secrets/backend/kv/kv-v2-workflow-navigation-test.js b/ui/tests/acceptance/secrets/backend/kv/kv-v2-workflow-navigation-test.js index 54327e8d350c..24586a99e5ad 100644 --- a/ui/tests/acceptance/secrets/backend/kv/kv-v2-workflow-navigation-test.js +++ b/ui/tests/acceptance/secrets/backend/kv/kv-v2-workflow-navigation-test.js @@ -207,6 +207,13 @@ module('Acceptance | kv-v2 workflow | navigation', function (hooks) { await click(PAGE.breadcrumbAtIdx(1)); assert.ok(currentURL().startsWith(`/vault/secrets/${backend}/kv/list`), 'links back to list root'); }); + test('is redirects to nested secret using old non-engine url (a)', async function (assert) { + // Reported bug, backported fix https://github.com/hashicorp/vault/pull/24281 + assert.expect(1); + const backend = this.backend; + await visit(`/vault/secrets/${backend}/list/app/`); + assert.strictEqual(currentURL(), `/vault/secrets/${backend}/kv/list/app/`); + }); test('versioned secret nav, tabs, breadcrumbs (a)', async function (assert) { assert.expect(45); const backend = this.backend;