From e5edd7021c79a673d5cf8558861286a9fb8ea76a Mon Sep 17 00:00:00 2001 From: ishaan1124 Date: Sun, 30 Aug 2026 00:46:34 -0700 Subject: [PATCH] fix(desktop): render inline pages as UTF-8 --- .../cli/test/installation/desktop-shell-contract.test.ts | 7 +++++++ frontend/desktop/src/main.mjs | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/cli/test/installation/desktop-shell-contract.test.ts b/backend/cli/test/installation/desktop-shell-contract.test.ts index f8f8e3620..b93825fdd 100644 --- a/backend/cli/test/installation/desktop-shell-contract.test.ts +++ b/backend/cli/test/installation/desktop-shell-contract.test.ts @@ -6,6 +6,13 @@ test("lists existing macOS windows before the New Window Dock action", async () expect(dock.indexOf("...entries")).toBeLessThan(dock.indexOf('label: "New Window"')) }) +test("declares UTF-8 for every inline desktop document", async () => { + const source = await Bun.file(new URL("../../../../frontend/desktop/src/main.mjs", import.meta.url)).text() + + expect(source).not.toContain("data:text/html,") + expect(source.match(/data:text\/html;charset=utf-8,/g)).toHaveLength(3) +}) + test("wires the packaged macOS shell to the authenticated desktop updater", async () => { const source = await Bun.file(new URL("../../../../frontend/desktop/src/main.mjs", import.meta.url)).text() const updater = await Bun.file(new URL("../../../../frontend/desktop/src/updater.mjs", import.meta.url)).text() diff --git a/frontend/desktop/src/main.mjs b/frontend/desktop/src/main.mjs index be354858a..c30197b65 100644 --- a/frontend/desktop/src/main.mjs +++ b/frontend/desktop/src/main.mjs @@ -604,7 +604,7 @@ async function bootstrap(splash) { }) if (prompt.response !== 0) return false await splash.loadURL( - `data:text/html,${encodeURIComponent('

OpenScience

Installing in Applications…

')}`, + `data:text/html;charset=utf-8,${encodeURIComponent('

OpenScience

Installing in Applications…

')}`, ) let staged try { @@ -912,7 +912,7 @@ app }, }) await splash.loadURL( - `data:text/html,${encodeURIComponent('

OpenScience

Starting your local workspace…

')}`, + `data:text/html;charset=utf-8,${encodeURIComponent('

OpenScience

Starting your local workspace…

')}`, ) splash.show() if (await bootstrap(splash)) return @@ -966,7 +966,7 @@ app return } await splash.loadURL( - `data:text/html,${encodeURIComponent(`

OpenScience could not start

${html(message)}

`)}`, + `data:text/html;charset=utf-8,${encodeURIComponent(`

OpenScience could not start

${html(message)}

`)}`, ) } })