10d814d31a
Fixes incorrect generated manifest and generated directory for `index/[...dynamic]` pages Too much normalizing adding extra `index/` prefix to `index/[...dynamic]` routes which lead to the incorrected generated routes like `.next/server/pages/index/index/index/[...dynamic]` ## Bug Fixes https://github.com/vercel/customer-issues/issues/146 - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md`
15 lines
394 B
TypeScript
15 lines
394 B
TypeScript
import { isDynamicRoute } from '../shared/lib/router/utils'
|
|
|
|
export function normalizePathSep(path: string): string {
|
|
return path.replace(/\\/g, '/')
|
|
}
|
|
|
|
export function denormalizePagePath(page: string) {
|
|
page = normalizePathSep(page)
|
|
if (page.startsWith('/index/') && !isDynamicRoute(page)) {
|
|
page = page.slice(6)
|
|
} else if (page === '/index') {
|
|
page = '/'
|
|
}
|
|
return page
|
|
}
|