@devries-cameron20 / t3code-1 / commits / ce9b80671b
Fork 0

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

fix(server): theme files saved with a UTF-8 BOM are published instead of rejected (#32405)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Felix Laga committed Nov 7, 2026 at 19:43 UTC ce9b80671bbdf274d64109465963dc967cbe076a
2 files changed +4 -2
apps/server/src/environmentTheme.test.ts
+2 -1
@@ -125,6 +125,7 @@ it.layer(NodeServices.layer)("environment theme", (it) => {
125 withEnvironmentThemes(
126 {
127 "nightfall.json": encodeThemeFile(NIGHTFALL_THEME),
128 + "notepad.json": `\uFEFF${encodeThemeFile(SHARED_THEME)}`,
129 "unresolved.json":
130 '{ "name": "X", "appearance": "dark", "canvas": "{{ background }}", "accent": "#7aa2f7" }',
131 "malformed.json": "{ not json",
@@ -137,7 +138,7 @@ it.layer(NodeServices.layer)("environment theme", (it) => {
138 Effect.gen(function* () {
139 assert.deepEqual(
140 (yield* currentThemes).map((theme) => theme.id),
140 - ["nightfall"],
141 + ["nightfall", "notepad"],
142 );
143 }),
144 ),
apps/server/src/environmentTheme.ts
+2 -1
@@ -80,7 +80,8 @@ export const readThemeFileGuarded = (filePath: string, maxBytes: number): string
80 if (read <= 0) break;
81 offset += read;
82 }
83 - return contents.subarray(0, offset).toString("utf8");
83 + // Unlike Buffer#toString, TextDecoder drops a UTF-8 BOM, which JSON.parse rejects.
84 + return new TextDecoder().decode(contents.subarray(0, offset));
85 } catch {
86 return null;
87 } finally {