fixed nsfw true/false

This commit is contained in:
bill bittner 2017-06-26 19:39:12 -07:00
parent ae5711837a
commit a102027179
2 changed files with 5 additions and 3 deletions

View file

@ -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;

View file

@ -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);