From 8eb79a561ce32732ecc9f41c9284b3ee6488c66b Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 14 Nov 2024 10:25:35 +0100 Subject: [PATCH] fix: test routes without trailing slash --- modules/runtime/routes.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/runtime/routes.ts b/modules/runtime/routes.ts index 4d9663e4..68cfe4d5 100644 --- a/modules/runtime/routes.ts +++ b/modules/runtime/routes.ts @@ -1,3 +1,4 @@ +import { withoutTrailingSlash } from 'ufo' import _routes from '#build/routes' interface NuxtRoute { @@ -9,5 +10,5 @@ interface NuxtRoute { export const routes: NuxtRoute[] = _routes export const match = (path: string) => routes.find(r => - typeof r.path === 'string' ? r.path === path : r.path.test(path), + typeof r.path === 'string' ? r.path === withoutTrailingSlash(path) : r.path.test(withoutTrailingSlash(path)), ) -- 2.54.0