pull/70/head
Piero Toffanin 2019-02-01 16:20:03 -05:00
rodzic a489a95d6e
commit 06fef5549b
2 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -30,6 +30,7 @@ const Task = require('./Task');
const async = require('async'); const async = require('async');
const odmInfo = require('./odmInfo'); const odmInfo = require('./odmInfo');
const request = require('request'); const request = require('request');
const utils = require('./utils');
const download = function(uri, filename, callback) { const download = function(uri, filename, callback) {
request.head(uri, function(err, res, body) { request.head(uri, function(err, res, body) {
@ -62,7 +63,7 @@ const upload = multer({
}); });
}, },
filename: (req, file, cb) => { filename: (req, file, cb) => {
let filename = file.originalname; let filename = utils.sanitize(file.originalname);
if (filename === "body.json") filename = "_body.json"; if (filename === "body.json") filename = "_body.json";
cb(null, filename); cb(null, filename);
} }

Wyświetl plik

@ -13,5 +13,9 @@ module.exports = {
} }
} }
return defaultValue; return defaultValue;
},
sanitize: function(filePath){
return filePath.replace(/(\/|\\)/g, "_");
} }
}; };