Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix(server): serve html assets with utf-8 charset (#6409)
Zach Webb820e5639c30b
diff --git a/apps/server/src/http.test.ts b/apps/server/src/http.test.tsindex ec4d2aae1..f85de08d4 100644--- a/apps/server/src/http.test.ts+++ b/apps/server/src/http.test.ts@@ -44,4 +44,15 @@ describe("assetResponseHeaders", () => {"X-Content-Type-Options": "nosniff",});});++ it("declares utf-8 for HTML assets so non-ASCII content renders correctly", () => {+ expect(assetResponseHeaders("/workspace/page.html")).toHaveProperty(+ "Content-Type",+ "text/html; charset=utf-8",+ );+ expect(assetResponseHeaders("/workspace/PAGE.HTM")).toHaveProperty(+ "Content-Type",+ "text/html; charset=utf-8",+ );+ });});diff --git a/apps/server/src/http.ts b/apps/server/src/http.tsindex 0da55686b..be133399e 100644--- a/apps/server/src/http.ts+++ b/apps/server/src/http.ts@@ -46,10 +46,14 @@ const DESKTOP_RENDERER_ORIGINS = ["t3code://app", "t3code-dev://app"];const SVG_CONTENT_SECURITY_POLICY = "default-src 'none'; style-src 'unsafe-inline'; sandbox";export function assetResponseHeaders(filePath: string): Record<string, string> {+ const lowerPath = filePath.toLowerCase();return {"Cache-Control": "private, max-age=3600","X-Content-Type-Options": "nosniff",- ...(filePath.toLowerCase().endsWith(".svg")+ ...(lowerPath.endsWith(".html") || lowerPath.endsWith(".htm")+ ? { "Content-Type": "text/html; charset=utf-8" }+ : {}),+ ...(lowerPath.endsWith(".svg")? { "Content-Security-Policy": SVG_CONTENT_SECURITY_POLICY }: {}),};