diff --git a/scm-ui/ui-webapp/src/repos/codeSection/components/CodeViewSwitcher.tsx b/scm-ui/ui-webapp/src/repos/codeSection/components/CodeViewSwitcher.tsx index a6f8a70d7e..f423305aa5 100644 --- a/scm-ui/ui-webapp/src/repos/codeSection/components/CodeViewSwitcher.tsx +++ b/scm-ui/ui-webapp/src/repos/codeSection/components/CodeViewSwitcher.tsx @@ -17,9 +17,12 @@ type Props = { const CodeViewSwitcher: FC = ({ url }) => { const [t] = useTranslation("repos"); - const createDestinationUrl = (destination: string) => { + const createDestinationUrl = (destination: string, removePath: boolean) => { let splittedUrl = url.split("/"); splittedUrl[5] = destination; + if (removePath) { + splittedUrl.splice(7, splittedUrl.length); + } return splittedUrl.join("/"); }; @@ -29,13 +32,13 @@ const CodeViewSwitcher: FC = ({ url }) => { label={t("code.commits")} icon="fa fa-exchange-alt" color={url.includes("/code/changesets") ? "link is-selected" : undefined} - link={createDestinationUrl("changesets")} + link={createDestinationUrl("changesets", true)} /> );