fixing issues with bad import uploads, fixed #186
parent
fb158d2eb8
commit
e0cf6098fb
|
@ -60,11 +60,20 @@ exports.doImport = function(req, res, padId)
|
|||
form.uploadDir = tempDirectory;
|
||||
|
||||
form.parse(req, function(err, fields, files)
|
||||
{
|
||||
//the upload failed, stop at this point
|
||||
if(err || files.file === undefined)
|
||||
{
|
||||
console.warn("Uploading Error: " + err.stack);
|
||||
callback("uploadFailed");
|
||||
}
|
||||
//everything ok, continue
|
||||
else
|
||||
{
|
||||
//save the path of the uploaded file
|
||||
srcFile = files.file.path;
|
||||
|
||||
callback(err);
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -157,6 +166,13 @@ exports.doImport = function(req, res, padId)
|
|||
}
|
||||
], function(err)
|
||||
{
|
||||
//the upload failed, there is nothing we can do, send a 500
|
||||
if(err == "uploadFailed")
|
||||
{
|
||||
res.send(500);
|
||||
return;
|
||||
}
|
||||
|
||||
if(err) throw err;
|
||||
|
||||
//close the connection
|
||||
|
|
Loading…
Reference in New Issue