diff --git a/src/pages/studio/[...path].ts b/src/pages/studio/[...path].ts index 748be75..da40acb 100644 --- a/src/pages/studio/[...path].ts +++ b/src/pages/studio/[...path].ts @@ -14,7 +14,13 @@ export const GET: APIRoute = () => { ); } - return new Response(readFileSync(indexPath, "utf-8"), { + // Rewrite absolute asset paths from /static/ to /studio/static/ so + // the studio's JS/CSS/icons load correctly when hosted at /studio. + const html = readFileSync(indexPath, "utf-8") + .replaceAll('="/static/', '="/studio/static/') + .replaceAll("='/static/", "='/studio/static/"); + + return new Response(html, { status: 200, headers: { "Content-Type": "text/html; charset=utf-8" }, });