Skip to content

Commit 6feee5d

Browse files
authored
fix(gatsby): encode window.pagePath to get valid JS code (#36349)
1 parent 3b31e35 commit 6feee5d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/gatsby/cache-dir/static-entry.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,9 @@ export default async function staticPage({
421421
})
422422

423423
// Add page metadata for the current page
424-
const windowPageData = `/*<![CDATA[*/window.pagePath="${pagePath}";${
424+
const windowPageData = `/*<![CDATA[*/window.pagePath=${JSON.stringify(
425+
pagePath
426+
)};${
425427
process.env.GATSBY_SLICES
426428
? ``
427429
: `window.___webpackCompilationHash="${webpackCompilationHash}";`

0 commit comments

Comments
 (0)