From 20f481f6f8ef458751fbed4cf86965b3853bea24 Mon Sep 17 00:00:00 2001 From: Mohammad Saleh Fadaei <54557683+ms-fadaei@users.noreply.github.com> Date: Thu, 1 Jul 2021 17:26:08 +0430 Subject: [PATCH] fix(utils): `trailingSlash` causes error with dynamic nuxt-child routes (#9505) --- packages/utils/src/route.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/utils/src/route.js b/packages/utils/src/route.js index edc9616d6794..97d53ae1032d 100644 --- a/packages/utils/src/route.js +++ b/packages/utils/src/route.js @@ -56,7 +56,7 @@ function cleanChildrenRoutes (routes, isChild = false, routeNameSplitter = '-', route.path = isChild ? route.path.replace('/', '') : route.path if (route.path.includes('?')) { if (route.name.endsWith(`${routeNameSplitter}index`)) { - route.path = route.path.replace(/\?$/, '') + route.path = route.path.replace(/\?\/?$/, trailingSlash ? '/' : '') } const names = route.name.replace(regExpParentRouteName, '').split(routeNameSplitter) const paths = route.path.split('/')