Skip to content

Commit

Permalink
fix(utils): flatRoutes regex for nested routes with trailing slash en…
Browse files Browse the repository at this point in the history
…abled (#6791)
  • Loading branch information
cain authored and pi0 committed Dec 16, 2019
1 parent e999060 commit ae769ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/utils/src/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const flatRoutes = function flatRoutes (router, fileName = '', routes = [
}
return flatRoutes(r.children, fileName + r.path + '/', routes)
}
fileName = fileName.replace(/^\/+$/, '/')
fileName = fileName.replace(/\/+/g, '/')
routes.push(
(r.path === '' && fileName[fileName.length - 1] === '/'
? fileName.slice(0, -1)
Expand Down

0 comments on commit ae769ce

Please sign in to comment.