mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 00:45:44 +01:00
Fix routing for entity names with parenthesis (#1998)
If entities like users, groups or repository namespaces contains parenthesis the frontend router gets confused and doesn't work properly. To fix this issue we escape the chars in the url which may cause such problems because they are reserved by the http url schema. Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com> Co-authored-by: Florian Scholdei <florian.scholdei@cloudogu.com>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
import { urls } from "@scm-manager/ui-api";
|
||||
import { useLocation, useRouteMatch } from "react-router-dom";
|
||||
import { RoutingProps } from "./RoutingProps";
|
||||
|
||||
@@ -33,8 +34,8 @@ const useActiveMatch = ({ to, activeOnlyWhenExact, activeWhenMatch }: RoutingPro
|
||||
}
|
||||
|
||||
const match = useRouteMatch({
|
||||
path,
|
||||
exact: activeOnlyWhenExact,
|
||||
path: urls.escapeUrlForRoute(path),
|
||||
exact: activeOnlyWhenExact
|
||||
});
|
||||
|
||||
const location = useLocation();
|
||||
@@ -42,7 +43,7 @@ const useActiveMatch = ({ to, activeOnlyWhenExact, activeWhenMatch }: RoutingPro
|
||||
const isActiveWhenMatch = () => {
|
||||
if (activeWhenMatch) {
|
||||
return activeWhenMatch({
|
||||
location,
|
||||
location
|
||||
});
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user