Strengthened param check on /task/new

pull/1/head
Piero Toffanin 2016-10-26 12:50:08 -04:00
rodzic fdc5529152
commit 5ea69e5e66
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -114,7 +114,7 @@ let server;
* $ref: '#/definitions/Error' * $ref: '#/definitions/Error'
*/ */
app.post('/task/new', addRequestId, upload.array('images'), (req, res) => { app.post('/task/new', addRequestId, upload.array('images'), (req, res) => {
if (req.files.length === 0) res.json({error: "Need at least 1 file."}); if (!req.files || req.files.length === 0) res.json({error: "Need at least 1 file."});
else{ else{
let srcPath = path.join("tmp", req.id); let srcPath = path.join("tmp", req.id);
let destPath = path.join(Directories.data, req.id); let destPath = path.join(Directories.data, req.id);