[v9.4.x] Frontend: Fix broken links in /plugins when pathname has a trailing slash (#64608)

Frontend: Fix broken links in /plugins when pathname has a trailing slash (#64348)

Fix broken links in /plugins when pathname has a trailing slash

(cherry picked from commit a05cb1e78e)

Co-authored-by: William Assis <35489495+gassiss@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2023-03-13 13:53:13 +01:00
committed by GitHub
co-authored by William Assis
parent 7a26957f87
commit 53a06bf65f
@@ -18,8 +18,8 @@ interface Props {
export const PluginList = ({ plugins, displayMode }: Props) => {
const isList = displayMode === PluginListDisplayMode.List;
const styles = useStyles2(getStyles);
const location = useLocation();
const pathName = config.appSubUrl + location.pathname;
const { pathname } = useLocation();
const pathName = config.appSubUrl + (pathname.endsWith('/') ? pathname.slice(0, -1) : pathname);
return (
<div className={cx(styles.container, { [styles.list]: isList })} data-testid="plugin-list">