From 8f3a74ddb43732ad8c0ee8aae21c5cf584d33e02 Mon Sep 17 00:00:00 2001 From: bigjakk Date: Sun, 1 Mar 2026 12:29:52 -0800 Subject: [PATCH] =?UTF-8?q?v0.5.5=20=E2=80=94=20Fix=20ERR=5FFILE=5FNOT=5FF?= =?UTF-8?q?OUND=20log=20spam=20in=20resource=20swapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wrap net.fetch() in the kpc-swap protocol handler with try/catch and return a 404 response on failure instead of letting the error propagate as an uncaught promise rejection. Revert workflow cache changes. Co-Authored-By: Claude Opus 4.6 --- package.json | 2 +- src/main/swapper.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 36b111e..f339fea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "krunker-civilian-client", - "version": "0.5.4", + "version": "0.5.5", "description": "Cross-platform Krunker game client", "main": "dist/main/index.js", "homepage": "https://gitea.crjlab.net/bigjakk/krunker-civilian-client", diff --git a/src/main/swapper.ts b/src/main/swapper.ts index 025ca1c..8c28555 100644 --- a/src/main/swapper.ts +++ b/src/main/swapper.ts @@ -35,7 +35,7 @@ export function initSwapperProtocol(): void { * Must be called AFTER app.ready. */ export function registerSwapperFileProtocol(ses: Session): void { - ses.protocol.handle(PROTOCOL_NAME, (request) => { + ses.protocol.handle(PROTOCOL_NAME, async (request) => { const url = new URL(request.url); // Reconstruct the file path from the URL // Windows: kpc-swap://C/foo/bar → C:/foo/bar @@ -47,7 +47,11 @@ export function registerSwapperFileProtocol(ses: Session): void { } else { filePath = url.pathname; } - return net.fetch(`file://${filePath}`); + try { + return await net.fetch(`file://${filePath}`); + } catch { + return new Response('Not found', { status: 404 }); + } }); }