proper string body check

This commit is contained in:
jane 2021-06-06 00:26:35 -04:00
parent b145d6e538
commit bb90e7458b

View file

@ -103,7 +103,7 @@ function diff(current, checked) {
app.post("/updates/:project(\\w+)", (req, res) => { app.post("/updates/:project(\\w+)", (req, res) => {
let project_id = req.params['project']; 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 adjustedBody = body.replace(/\r/, "");
let indexes = get_indexes(project_id); let indexes = get_indexes(project_id);
let difference = diff(indexes, adjustedBody); let difference = diff(indexes, adjustedBody);