From a102027179fa0944d2198e9a94f4a946cfd78f34 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Mon, 26 Jun 2017 19:39:12 -0700 Subject: [PATCH] fixed nsfw true/false --- helpers/libraries/publishHelpers.js | 4 +++- routes/api-routes.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/helpers/libraries/publishHelpers.js b/helpers/libraries/publishHelpers.js index 7a1f0699..60ab5eb3 100644 --- a/helpers/libraries/publishHelpers.js +++ b/helpers/libraries/publishHelpers.js @@ -7,7 +7,9 @@ module.exports = { createPublishParams (name, filePath, license, nsfw) { logger.debug(`Creating Publish Parameters for "${name}"`); // ensure nsfw is a boolean - if (nsfw.toLowerCase === 'false') { + if (nsfw === false) { + nsfw = false; + } else if (nsfw.toLowerCase === 'false') { nsfw = false; } else if (nsfw.toLowerCase === 'off') { nsfw = false; diff --git a/routes/api-routes.js b/routes/api-routes.js index b5f802bc..eadb3c05 100644 --- a/routes/api-routes.js +++ b/routes/api-routes.js @@ -34,7 +34,7 @@ module.exports = app => { // route to run a publish request on the daemon app.post('/api/publish', multipartMiddleware, ({ originalUrl, body, files }, res) => { logger.debug(`POST request on ${originalUrl}`); - // validate that a file was provided (note: need to validate it is not a potentially harmful file type) + // validate that a file was provided const file = files.speech || files.null; if (!file) { res.status(400).send('Error: No file was submitted or the key used was incorrect. Files posted through this route must use a key of "speech" or null'); @@ -74,7 +74,7 @@ module.exports = app => { const filePath = file.path; const fileType = file.type; /* - make sure it's not a harmful file type + note: make sure it's not a harmful file type */ // prepare the publish parameters const publishParams = publishHelpers.createPublishParams(name, filePath, license, nsfw);