mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Merge pull request #125 from Dahlgren/bugfix/missions-whitelist-pbo
Whitelist .pbo files for mission upload
This commit is contained in:
commit
442e1a9005
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user