From 05c014cde78b5e415b53eb86c5ce07481a16eaf0 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Thu, 14 Mar 2024 15:59:44 +0100 Subject: [PATCH] fix: uri decode breadcrumbs (#6557) --- .../BreadcrumbNav/BreadcrumbNav.test.tsx | 22 +++++++++++++++++++ .../common/BreadcrumbNav/BreadcrumbNav.tsx | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 frontend/src/component/common/BreadcrumbNav/BreadcrumbNav.test.tsx diff --git a/frontend/src/component/common/BreadcrumbNav/BreadcrumbNav.test.tsx b/frontend/src/component/common/BreadcrumbNav/BreadcrumbNav.test.tsx new file mode 100644 index 0000000000..23f2db94d6 --- /dev/null +++ b/frontend/src/component/common/BreadcrumbNav/BreadcrumbNav.test.tsx @@ -0,0 +1,22 @@ +import { render } from 'utils/testRenderer'; +import { Route, Routes } from 'react-router-dom'; +import BreadcrumbNav from './BreadcrumbNav'; +import { screen } from '@testing-library/react'; + +test('decode URI encoded path in breadcrumbs nav', async () => { + render( + + } + /> + , + { + route: '/applications/my%20app/my%20instance', + }, + ); + + await screen.findByText('applications'); + await screen.findByText('my app'); + await screen.findByText('my instance'); +}); diff --git a/frontend/src/component/common/BreadcrumbNav/BreadcrumbNav.tsx b/frontend/src/component/common/BreadcrumbNav/BreadcrumbNav.tsx index e05ab60cdb..f936c9f3bd 100644 --- a/frontend/src/component/common/BreadcrumbNav/BreadcrumbNav.tsx +++ b/frontend/src/component/common/BreadcrumbNav/BreadcrumbNav.tsx @@ -49,7 +49,8 @@ const BreadcrumbNav = () => { item !== 'create-toggle' && item !== 'settings' && item !== 'profile', - ); + ) + .map(decodeURI); return (