Skip to content

Commit

Permalink
fixing issues with bad import uploads, fixed #186
Browse files Browse the repository at this point in the history
  • Loading branch information
Pita committed Oct 19, 2011
1 parent fb158d2 commit e0cf609
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions node/handler/ImportHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,19 @@ exports.doImport = function(req, res, padId)

form.parse(req, function(err, fields, files)
{
//save the path of the uploaded file
srcFile = files.file.path;

callback(err);
//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();
}
});
},

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e0cf609

Please sign in to comment.