Fixed bug with URL containing URL-encoded characters

This commit is contained in:
Dorian Niemiec 2024-01-29 19:03:20 +00:00
parent 98194e6f47
commit 45139795f5

View file

@ -151,8 +151,8 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
headers: req.headers,
input: inputStream,
scriptName: a,
pathInfo: decodeURI(b),
pathTranslated: b ? decodeURI((process.cwd() + (require("os").platform == "win32" ? b.replace(/\//g, "\\") : b)).replace((require("os").platform == "win32" ? /\\\\/g : /\/\//g), (require("os").platform == "win32" ? "\\" : "/"))) : "",
pathInfo: decodeURIComponent(b),
pathTranslated: b ? ((process.cwd() + decodeURIComponent(require("os").platform == "win32" ? b.replace(/\//g, "\\") : b)).replace((require("os").platform == "win32" ? /\\\\/g : /\/\//g), (require("os").platform == "win32" ? "\\" : "/"))) : "",
scheme: req.socket.encrypted ? "https" : "http",
env: {},
jsgi: {
@ -200,14 +200,14 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
}
if (href.match(new RegExp("/jsgi-bin(?:$|[?#/])",os.platform() == "win32" ? "i" : ""))) {
fs.stat("." + href, function (err, stats) {
fs.stat("." + decodeURIComponent(href), function (err, stats) {
if (!err) {
if (!stats.isFile()) {
elseCallback();
} else {
try {
executeJSGIWithReqObj(
href,
decodeURIComponent(href),
"",
req,
res,
@ -276,7 +276,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
}
});
}
checkPath("." + href, function (pathp) {
checkPath("." + decodeURIComponent(href), function (pathp) {
if (!pathp) {
elseCallback();
} else {