added error chck for file sending
This commit is contained in:
parent
d817ab02b0
commit
7044a09cd6
1 changed files with 6 additions and 1 deletions
|
@ -8,7 +8,12 @@ const serveFile = ({ filePath, fileType }, res) => {
|
|||
'Content-Type' : fileType || 'image/jpeg',
|
||||
},
|
||||
};
|
||||
res.status(200).sendFile(filePath, sendFileOptions);
|
||||
res.status(200).sendFile(filePath, sendFileOptions, (error) => {
|
||||
if (error) {
|
||||
logger.warn(error);
|
||||
res.status(404).send();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = serveFile;
|
||||
|
|
Loading…
Reference in a new issue