diff --git a/.changeset/proud-buses-hug.md b/.changeset/proud-buses-hug.md new file mode 100644 index 000000000000..98213f1c84a1 --- /dev/null +++ b/.changeset/proud-buses-hug.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +Decode fetched resources before checking against manifest when prerendering diff --git a/packages/kit/src/runtime/server/page/load_node.js b/packages/kit/src/runtime/server/page/load_node.js index 66a61a9ff4ca..bb878ae14b61 100644 --- a/packages/kit/src/runtime/server/page/load_node.js +++ b/packages/kit/src/runtime/server/page/load_node.js @@ -105,7 +105,7 @@ export async function load_node({ // handle fetch requests for static assets. e.g. prebaked data, etc. // we need to support everything the browser's fetch supports const prefix = options.paths.assets || options.paths.base; - const filename = ( + const filename = decodeURIComponent( resolved.startsWith(prefix) ? resolved.slice(prefix.length) : resolved ).slice(1); const filename_html = `${filename}/index.html`; // path may also match path/index.html diff --git a/packages/kit/test/prerendering/basics/src/routes/load-file-with-spaces.svelte b/packages/kit/test/prerendering/basics/src/routes/load-file-with-spaces.svelte new file mode 100644 index 000000000000..b0a3d165fac2 --- /dev/null +++ b/packages/kit/test/prerendering/basics/src/routes/load-file-with-spaces.svelte @@ -0,0 +1,25 @@ + + + + +