mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-02 03:25:56 +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:
@@ -108,3 +108,11 @@ export function matchedUrl(props: any) {
|
||||
const match = props.match;
|
||||
return matchedUrlFromMatch(match);
|
||||
}
|
||||
|
||||
export function escapeUrlForRoute(url: string) {
|
||||
return url.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||
}
|
||||
|
||||
export function unescapeUrlForRoute(url: string) {
|
||||
return url.replace(/\\/g, "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user