From 1ac95144be128bd600775dbb9fee0a9cb14a3b4b Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Wed, 23 Jul 2025 03:24:00 +0700 Subject: [PATCH] ELECTRON: Specify mime type when loading wasm files (#2262) --- electron/main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/electron/main.js b/electron/main.js index 680e0b359..eebf5612c 100644 --- a/electron/main.js +++ b/electron/main.js @@ -219,7 +219,11 @@ app.on("ready", async () => { relativePath = path.relative(__dirname, realPath); // Only allow access to files in "dist" folder or html files in the same directory if (method === "GET" && (relativePath.startsWith("dist") || relativePath.match(/^[a-zA-Z-_]*\.html/))) { - return new Response(readFileSync(realPath)); + const customHeaders = {}; + if (relativePath.endsWith(".wasm")) { + customHeaders["Content-Type"] = "application/wasm"; + } + return new Response(readFileSync(realPath), { headers: new Headers(customHeaders) }); } } catch (error) { log.error(error);