@devries-cameron20 / t3code-1 / commits / 820e5639c3
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): serve html assets with utf-8 charset (#6409)

Zach Webb committed Aug 21, 2026 at 03:10 UTC 820e5639c30be83a9433f696613760f8ee42075a
2 files changed +16 -1
apps/server/src/http.test.ts
+11
@@ -44,4 +44,15 @@ describe("assetResponseHeaders", () => {
44 "X-Content-Type-Options": "nosniff",
45 });
46 });
47 +
48 + it("declares utf-8 for HTML assets so non-ASCII content renders correctly", () => {
49 + expect(assetResponseHeaders("/workspace/page.html")).toHaveProperty(
50 + "Content-Type",
51 + "text/html; charset=utf-8",
52 + );
53 + expect(assetResponseHeaders("/workspace/PAGE.HTM")).toHaveProperty(
54 + "Content-Type",
55 + "text/html; charset=utf-8",
56 + );
57 + });
58 });
apps/server/src/http.ts
+5 -1
@@ -46,10 +46,14 @@ const DESKTOP_RENDERER_ORIGINS = ["t3code://app", "t3code-dev://app"];
46 const SVG_CONTENT_SECURITY_POLICY = "default-src 'none'; style-src 'unsafe-inline'; sandbox";
47
48 export function assetResponseHeaders(filePath: string): Record<string, string> {
49 + const lowerPath = filePath.toLowerCase();
50 return {
51 "Cache-Control": "private, max-age=3600",
52 "X-Content-Type-Options": "nosniff",
52 - ...(filePath.toLowerCase().endsWith(".svg")
53 + ...(lowerPath.endsWith(".html") || lowerPath.endsWith(".htm")
54 + ? { "Content-Type": "text/html; charset=utf-8" }
55 + : {}),
56 + ...(lowerPath.endsWith(".svg")
57 ? { "Content-Security-Policy": SVG_CONTENT_SECURITY_POLICY }
58 : {}),
59 };