Change the example code in tentative documentation to match the URL parser changes
This commit is contained in:
parent
303fc3dbb4
commit
d2922b0fed
1 changed files with 2 additions and 2 deletions
|
@ -1601,7 +1601,7 @@ module.exports = (req, res, logFacilities, config, next) => {
|
||||||
if (req.parsedURL.pathname == "/page.svr") {
|
if (req.parsedURL.pathname == "/page.svr") {
|
||||||
fs.readFile(".template", (err, data) => {
|
fs.readFile(".template", (err, data) => {
|
||||||
if (err) throw err; //EVIL!!!
|
if (err) throw err; //EVIL!!!
|
||||||
let id = req.parsedURL.searchParams.get("id");
|
let id = req.parsedURL.query.id;
|
||||||
if (!id) id = "index";
|
if (!id) id = "index";
|
||||||
if (fs.existsSync("pages/" + id + ".html")) {
|
if (fs.existsSync("pages/" + id + ".html")) {
|
||||||
fs.readFile("pages/" + id + ".html", (err2, data2) => {
|
fs.readFile("pages/" + id + ".html", (err2, data2) => {
|
||||||
|
@ -1643,7 +1643,7 @@ module.exports = (req, res, logFacilities, config, next) => {
|
||||||
res.error(500, err);
|
res.error(500, err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let id = req.parsedURL.searchParams.get("id");
|
let id = req.parsedURL.query.id;
|
||||||
if (!id) id = "index";
|
if (!id) id = "index";
|
||||||
id = id.replace(/\\/g,"/").replace(/(?:\/|^)\.\.(?=(\/|$))/g,"$1").replace(/\/+/g,"/"); //Poor mans path sanitiation
|
id = id.replace(/\\/g,"/").replace(/(?:\/|^)\.\.(?=(\/|$))/g,"$1").replace(/\/+/g,"/"); //Poor mans path sanitiation
|
||||||
if (fs.existsSync("pages/" + id + ".html")) {
|
if (fs.existsSync("pages/" + id + ".html")) {
|
||||||
|
|
Reference in a new issue