Fix issue with uploading sermon - file was not being moved from tmp folder

Transactions
Dan 2017-10-01 17:08:30 -06:00
parent 9db3033e71
commit 85f0793d91
1 changed files with 8 additions and 1 deletions

View File

@ -109,7 +109,14 @@ router.post("/a/", function(req,res){
res.status(404).json({"status":404,"message":"Sermon does not exist"});
return;
}
res.status(201).json({"status":201,"sermon":sermon});
renameFile(req.body.tmpPath,req.body.finalPath,function(err){
if (err){
removeFile(req.body.tmpPath);
res.status(500).json({"status":500,"message":"Could not rename the temp file"});
} else {
res.status(201).json({"status":201,"sermon":sermon});
}
});
/////******************************
/////Add the sermon to the postgres db for the existing site
// var pg = require("../database/postgres-for-old-db/addSermon");