diff --git a/Server/src/routes/api/sermons.js b/Server/src/routes/api/sermons.js index 3247e51..16f0e95 100644 --- a/Server/src/routes/api/sermons.js +++ b/Server/src/routes/api/sermons.js @@ -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"}); + } + }); });