From c278c6f61732c83a389a0eb4c090734faeedf0be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Dahlgren?= Date: Sun, 2 Dec 2018 22:38:29 +0100 Subject: [PATCH] Whitelist .pbo files for mission upload --- routes/missions.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/routes/missions.js b/routes/missions.js index b231e4a..c8eeba1 100644 --- a/routes/missions.js +++ b/routes/missions.js @@ -1,7 +1,9 @@ +var async = require('async') var express = require('express') var multer = require('multer') +var path = require('path') + var upload = multer({ storage: multer.diskStorage({}) }) -var async = require('async') module.exports = function (missionsManager) { var router = express.Router() @@ -11,8 +13,12 @@ module.exports = function (missionsManager) { }) router.post('/', upload.array('missions', 64), function (req, res) { + var missions = req.files.filter(function (file) { + return path.extname(file.originalname) === '.pbo' + }) + async.parallelLimit( - req.files.map(function (missionFile) { + missions.map(function (missionFile) { return function (next) { missionsManager.handleUpload(missionFile, next) }