Skip to content

Commit

Permalink
Make sure passed route path matches what was given
Browse files Browse the repository at this point in the history
  • Loading branch information
fs-c committed Aug 3, 2021
1 parent ee60891 commit fd44e2e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export const buildPages = async (
// Compute all routes (all folders where a .html file will eventually
// be generated to
const routePaths = page.getPaths ? (
(await page.getPaths()).map((p) => path.join(pageDir, p))
(await page.getPaths()).map((p) => pageDir + path.sep + p)
) : (
[ parsedPagePath.name === 'index' ? pageDir : parsedPagePath.name ]
)
Expand All @@ -304,7 +304,8 @@ export const buildPages = async (

// Strip the previously prepended pageDir from the routePath since
// getProps expects the values that were returned from getPaths
const props = await page.getProps(routePath.slice(pageDir.length))
const props = await page.getProps(routePath.slice((
pageDir + path.sep).length))
const html = createElement(Wrapper, {
Component: page.default, pageProps: props
}).toString()
Expand Down

0 comments on commit fd44e2e

Please sign in to comment.