Skip to content

Commit

Permalink
fix(prerender): encode urls passed to local fetch (#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
manh-gntvn authored Jan 30, 2023
1 parent 762ee47 commit 930438a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ export async function prerender(nitro: Nitro) {
const _route: PrerenderGenerateRoute = { route };

// Fetch the route
const res = await (localFetch(withBase(route, nitro.options.baseURL), {
headers: { "x-nitro-prerender": route },
const encodedRoute = encodeURI(route)
const res = await (localFetch(withBase(encodedRoute, nitro.options.baseURL), {
headers: { "x-nitro-prerender": encodedRoute },
}) as ReturnType<typeof fetch>);
_route.data = await res.arrayBuffer();
Object.defineProperty(_route, "contents", {
Expand Down

0 comments on commit 930438a

Please sign in to comment.