Ver código fonte

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
Kanacchi 7 anos atrás
pai
commit
e2885bd37c
1 arquivos alterados com 5 adições e 2 exclusões
  1. 5 2
      controllers/uploadController.js

+ 5 - 2
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);
 	}