aboutsummaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorJoelHMikael <joel.h.kronqvist@gmail.com>2021-12-06 16:08:23 +0200
committerJoelHMikael <joel.h.kronqvist@gmail.com>2021-12-06 16:08:23 +0200
commit68bfb9cc8eeaeb93fa6b4eae649d82ddb1f01234 (patch)
tree98a554d8730b9f034a1ce021d16db16bcceb2f3d /server.js
parentfbfdfaec51be5a7ead56a2888e4864c8b3470db5 (diff)
downloadLYLLRuoka-68bfb9cc8eeaeb93fa6b4eae649d82ddb1f01234.tar.gz
LYLLRuoka-68bfb9cc8eeaeb93fa6b4eae649d82ddb1f01234.zip
Fixed the \r left over in parsing
Diffstat (limited to 'server.js')
-rw-r--r--server.js6
1 files changed, 3 insertions, 3 deletions
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(`<option value=\"${day}\">`, `<option value=\"${day}\" selected>`);