From e2885bd37cfbd9da09a01203d153718ccc5862f6 Mon Sep 17 00:00:00 2001 From: Kanacchi Date: Mon, 3 Apr 2017 18:45:56 -0300 Subject: [PATCH] Made it so user doesn't need to specify blockedExtensions. This is useful if there are people already running lolisafe and updated to latest version --- controllers/uploadController.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/controllers/uploadController.js b/controllers/uploadController.js index 400b559..ee2dab5 100644 --- a/controllers/uploadController.js +++ b/controllers/uploadController.js @@ -22,8 +22,11 @@ const upload = multer({ storage: storage, limits: { fileSize: config.uploads.maxSize }, fileFilter: function(req, file, cb) { - if (config.blockedExtensions.some(extension => path.extname(file.originalname) === extension)) { - return cb('This file extension is not allowed'); + if (config.blockedExtensions !== undefined) { + if (config.blockedExtensions.some(extension => path.extname(file.originalname) === extension)) { + return cb('This file extension is not allowed'); + } + return cb(null, true); } return cb(null, true); }