From fd81459b0192e4e796eb1495a411a7a94bb9e74c Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 8 Nov 2021 19:21:46 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Accept=20urls=20without=20traili?= =?UTF-8?q?ng=20slashes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/routing/ViewSetRouter.tsx | 2 +- frontend/src/utils/ParsePath.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/routing/ViewSetRouter.tsx b/frontend/src/components/routing/ViewSetRouter.tsx index 4f31963..c6d3605 100644 --- a/frontend/src/components/routing/ViewSetRouter.tsx +++ b/frontend/src/components/routing/ViewSetRouter.tsx @@ -55,7 +55,7 @@ export function ViewSetRouter({viewSet, unselec selection = viewSet.resources?.find(res => res.value[pkKey] === pk) if(!selection) { return ( - + ) } } diff --git a/frontend/src/utils/ParsePath.ts b/frontend/src/utils/ParsePath.ts index ace1476..1d692ce 100644 --- a/frontend/src/utils/ParsePath.ts +++ b/frontend/src/utils/ParsePath.ts @@ -63,7 +63,7 @@ function parsePathSegment({path, parsed, regex, key, next}: ParsePathSegmentConf // If the match fails, it means the matching is over if(!match || !match.groups) { - parsed.valid = path === "/" + parsed.valid = path === "" || path === "/" return parsed } @@ -73,7 +73,7 @@ function parsePathSegment({path, parsed, regex, key, next}: ParsePathSegmentConf parsed.count += 1 const results = next.map((func) => { - return func(rest, parsed) + return func(rest ?? "", parsed) }).reduce((a, b) => { return {...a, ...b} }, {})