From a94e619f1681d5294f4dd8c69a678da18568c9f5 Mon Sep 17 00:00:00 2001 From: Dorian Nimemiec Date: Thu, 15 Feb 2024 20:09:32 +0100 Subject: [PATCH] Fixed bug with URLs containing "cgi-bin" that don't refer to "cgi-bin" directory in the web root --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 5bf8232..264f77d 100644 --- a/index.js +++ b/index.js @@ -379,7 +379,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e executeCGI("." + a, req, res, dh, nEnv); } - var isCgiBin = href.match(new RegExp("/cgi-bin(?:$|[?#/])", os.platform() == "win32" ? "i" : "")); + var isCgiBin = href.match(new RegExp("^/cgi-bin(?:$|[?#/])", os.platform() == "win32" ? "i" : "")); var isScriptExt = scriptExts.indexOf("." + ext) != -1; if ((href == "/redbrick-interpreters.json" || href == "/redbrick-scriptexts.json" || (os.platform() == "win32" && (href.toLowerCase() == "/redbrick-interpreters.json" || href.toLowerCase() == "/redbrick-scriptexts.json"))) && path.normalize(__dirname + "/../../..") == process.cwd()) {