fix(utils): flatRoutes regex for nested routes with trailing slash enabled (#6791)

This commit is contained in:
Cain Hall 2019-12-17 07:19:40 +11:00 committed by Pooya Parsa
parent e999060da5
commit ae769ce763

View File

@ -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)