From bb90e7458bc1eb90fc3a5bcc1f563f25ff579acc Mon Sep 17 00:00:00 2001 From: Jane Petrovna Date: Sun, 6 Jun 2021 00:26:35 -0400 Subject: [PATCH] proper string body check --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index d20e199..9f9e113 100644 --- a/index.js +++ b/index.js @@ -103,7 +103,7 @@ function diff(current, checked) { app.post("/updates/:project(\\w+)", (req, res) => { let project_id = req.params['project']; - const body = String(req.body) || ""; + const body = (typeof req.body == "string") ? req.body : ""; let adjustedBody = body.replace(/\r/, ""); let indexes = get_indexes(project_id); let difference = diff(indexes, adjustedBody);