The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 19:45 UTC
fix(desktop): release-note entities named like Object.prototype keys stay literal (#35366)
Julius Marminge committed
Nov 12, 2026 at 08:52 UTC
34c5faa3c38bbbcc5914862e35c80a9969efd38d
2 files changed
+18
-12
apps/desktop/src/updates/releaseNotes.test.ts
+9
-3
@@ -241,14 +241,20 @@ describe("normalizeDesktopUpdateReleaseNotes", () => {
241
});
242
});
243
244
- it("does not throw on out-of-range numeric entities and keeps the literal", () => {
244
+ it("keeps unsupported entities literal, including out-of-range and Object.prototype names", () => {
245
const result = normalizeDesktopUpdateReleaseNotes(
246
- "- Broken entity �",
246
+ "- Broken entity �\n- Mentions &constructor; and &toString;",
247
"1.0.0",
248
"latest",
249
);
250
expect(result).toEqual({
251
- releaseNotes: [{ version: "1.0.0", items: ["Broken entity �"], totalItems: 1 }],
251
+ releaseNotes: [
252
+ {
253
+ version: "1.0.0",
254
+ items: ["Mentions &constructor; and &toString;", "Broken entity �"],
255
+ totalItems: 2,
256
+ },
257
+ ],
258
omittedReleaseCount: 0,
259
});
260
});
apps/desktop/src/updates/releaseNotes.ts
+9
-9
@@ -20,14 +20,14 @@ const MAX_RELEASE_NOTE_GROUPS = 6;
20
const MAX_RELEASE_NOTE_ITEMS_PER_GROUP = 8;
21
const MAX_RELEASE_NOTE_ITEM_LENGTH = 220;
22
23
-const HTML_ENTITY_REPLACEMENTS: Readonly<Record<string, string>> = {
24
- amp: "&",
25
- apos: "'",
26
- gt: ">",
27
- lt: "<",
28
- nbsp: " ",
29
- quot: '"',
30
-};
23
+const HTML_ENTITY_REPLACEMENTS: ReadonlyMap<string, string> = new Map([
24
+ ["amp", "&"],
25
+ ["apos", "'"],
26
+ ["gt", ">"],
27
+ ["lt", "<"],
28
+ ["nbsp", " "],
29
+ ["quot", '"'],
30
+]);
31
32
function decodeCodePoint(codePoint: number, entity: string): string {
33
if (!Number.isInteger(codePoint) || codePoint < 0 || codePoint > 0x10ffff) {
@@ -37,7 +37,7 @@ function decodeCodePoint(codePoint: number, entity: string): string {
37
}
38
39
function decodeHtmlEntity(entity: string): string {
40
- const named = HTML_ENTITY_REPLACEMENTS[entity];
40
+ const named = HTML_ENTITY_REPLACEMENTS.get(entity);
41
if (named) return named;
42
if (entity.startsWith("#x")) {
43
return decodeCodePoint(Number.parseInt(entity.slice(2), 16), entity);