From d2922b0fed11939666eee8bde65338b280df9c47 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Tue, 27 Aug 2024 19:16:11 +0200 Subject: [PATCH] Change the example code in tentative documentation to match the URL parser changes --- source/docs/tentative.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/docs/tentative.md b/source/docs/tentative.md index 8370666..81530b2 100644 --- a/source/docs/tentative.md +++ b/source/docs/tentative.md @@ -1601,7 +1601,7 @@ module.exports = (req, res, logFacilities, config, next) => { if (req.parsedURL.pathname == "/page.svr") { fs.readFile(".template", (err, data) => { if (err) throw err; //EVIL!!! - let id = req.parsedURL.searchParams.get("id"); + let id = req.parsedURL.query.id; if (!id) id = "index"; if (fs.existsSync("pages/" + id + ".html")) { fs.readFile("pages/" + id + ".html", (err2, data2) => { @@ -1643,7 +1643,7 @@ module.exports = (req, res, logFacilities, config, next) => { res.error(500, err); return; } - let id = req.parsedURL.searchParams.get("id"); + let id = req.parsedURL.query.id; if (!id) id = "index"; id = id.replace(/\\/g,"/").replace(/(?:\/|^)\.\.(?=(\/|$))/g,"$1").replace(/\/+/g,"/"); //Poor mans path sanitiation if (fs.existsSync("pages/" + id + ".html")) {