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

Fix broken links in /plugins when pathname has a trailing slash
This commit is contained in:
William Assis 2023-03-10 08:18:12 -05:00 committed by GitHub
parent 2f55911fa3
commit a05cb1e78e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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">