File download issues

Transactions
Dan 2017-09-29 14:36:31 -06:00
parent 202cc1dec3
commit 17b3c5e4cd
1 changed files with 6 additions and 1 deletions

View File

@ -64,7 +64,12 @@ router.get("/download/:id",function(req,res){
return;
}
var file = finalStorage + sermon.file;
res.download(file);
if (fs.existsSync(file)){
res.download(file);
} else {
res.status(404).json({"status":404,"message":"Could not find the file associated with this sermon"});
}
});
});