From ee75f1b438c17ea9d861c5334019705f88e753e6 Mon Sep 17 00:00:00 2001 From: RissRIce Date: Fri, 12 Jun 2026 16:40:18 -0600 Subject: [PATCH] fix: handle invalid static path encoding --- apps/commandboard-web/server.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/commandboard-web/server.js b/apps/commandboard-web/server.js index 6a61e34..b00e7da 100644 --- a/apps/commandboard-web/server.js +++ b/apps/commandboard-web/server.js @@ -35,7 +35,18 @@ createServer((request, response) => { return; } - const file = resolveStaticPath(url.pathname); + let file; + try { + file = resolveStaticPath(url.pathname); + } catch (error) { + if (error instanceof URIError) { + response.writeHead(400, { "content-type": "text/plain; charset=utf-8" }); + response.end("Invalid path encoding"); + return; + } + throw error; + } + if (!file) { response.writeHead(403); response.end("Forbidden");