From 68bfb9cc8eeaeb93fa6b4eae649d82ddb1f01234 Mon Sep 17 00:00:00 2001 From: JoelHMikael Date: Mon, 6 Dec 2021 16:08:23 +0200 Subject: Fixed the \r left over in parsing --- server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server.js') diff --git a/server.js b/server.js index 6274ba2..d4a1311 100644 --- a/server.js +++ b/server.js @@ -24,7 +24,8 @@ async function init() const errorPath = "./404/index.html"; let shiftcont = await openFile("./shifts.txt"); - const DB = await parse.build(shiftcont.toString("utf-8")); + shiftcont = shiftcont.toString("utf-8").replaceAll("\r", ""); // \r because of the \r\n newline on windows which creates problems + const DB = await parse.build(shiftcont); async function server(req, res) { @@ -96,8 +97,7 @@ async function buildMain(args) if (res === undefined) res = parse.get(day, index, DB); if (res === -1) - res = "Kyseiselle kurssille/opettajalle ei löydy ruokailua päivältä!"; - + res = "Kyseiselle kurssille/opettajalle ei löydy ruokailua päivältä!"; // it's the frickin \r in the database! data_string = data_string.replace("\\(result\\)", res); data_string = data_string.replace(`