removed default jpg content type and added missing content type error
This commit is contained in:
parent
5f486e3d50
commit
6fe04b13ce
1 changed files with 5 additions and 2 deletions
|
@ -1,13 +1,16 @@
|
|||
const logger = require('winston');
|
||||
|
||||
const serveFile = ({ filePath, fileType }, res) => {
|
||||
logger.verbose(`serving file: ${filePath}`);
|
||||
if (!fileType) {
|
||||
logger.error(`no fileType provided for ${filePath}`);
|
||||
}
|
||||
const sendFileOptions = {
|
||||
headers: {
|
||||
'X-Content-Type-Options': 'nosniff',
|
||||
'Content-Type' : fileType || 'image/jpeg',
|
||||
'Content-Type' : fileType,
|
||||
},
|
||||
};
|
||||
logger.debug(`fileOptions for ${filePath}:`, sendFileOptions);
|
||||
res.status(200).sendFile(filePath, sendFileOptions);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue