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
This commit is contained in:
parent
14cf45c168
commit
e2885bd37c
|
@ -22,11 +22,14 @@ const upload = multer({
|
||||||
storage: storage,
|
storage: storage,
|
||||||
limits: { fileSize: config.uploads.maxSize },
|
limits: { fileSize: config.uploads.maxSize },
|
||||||
fileFilter: function(req, file, cb) {
|
fileFilter: function(req, file, cb) {
|
||||||
|
if (config.blockedExtensions !== undefined) {
|
||||||
if (config.blockedExtensions.some(extension => path.extname(file.originalname) === extension)) {
|
if (config.blockedExtensions.some(extension => path.extname(file.originalname) === extension)) {
|
||||||
return cb('This file extension is not allowed');
|
return cb('This file extension is not allowed');
|
||||||
}
|
}
|
||||||
return cb(null, true);
|
return cb(null, true);
|
||||||
}
|
}
|
||||||
|
return cb(null, true);
|
||||||
|
}
|
||||||
}).array('files[]')
|
}).array('files[]')
|
||||||
|
|
||||||
uploadsController.upload = function(req, res, next) {
|
uploadsController.upload = function(req, res, next) {
|
||||||
|
|
Loading…
Reference in New Issue