Skip to content

Commit

Permalink
Merge pull request OpenDroneMap#218 from kauly/fix/task-new-zipurl
Browse files Browse the repository at this point in the history
fix: tmp dir creation
  • Loading branch information
pierotofy authored May 19, 2024
2 parents 72202a9 + d16f695 commit de3ea73
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"use strict";

const fs = require('fs');
const path = require('path');
const config = require('./config.js');
const packageJson = JSON.parse(fs.readFileSync('./package.json'));

Expand Down Expand Up @@ -285,6 +286,10 @@ app.post('/task/new', authCheck, taskNew.assignUUID, taskNew.uploadImages, (req,
req.body = req.body || {};
if ((!req.files || req.files.length === 0) && !req.body.zipurl) req.error = "Need at least 1 file or a zip file url.";
else if (config.maxImages && req.files && req.files.length > config.maxImages) req.error = `${req.files.length} images uploaded, but this node can only process up to ${config.maxImages}.`;
else if ((!req.files || req.files.length === 0) && req.body.zipurl) {
const srcPath = path.join("tmp", req.id);
fs.mkdirSync(srcPath);
}
next();
}, taskNew.createTask);

Expand Down

0 comments on commit de3ea73

Please sign in to comment.