0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Update content-negotiation.js

This commit is contained in:
G.Ambatte
2024-09-05 16:45:07 +12:00
committed by GitHub
parent ff60ca163f
commit 2e459118aa

View File

@@ -2,11 +2,11 @@ module.exports = (req, res, next)=>{
const isImageRequest = req.get('Accept')?.split(',')
?.filter((h)=>!h.includes('q='))
?.every((h)=>/image\/.*/.test(h));
if(isImageRequest) {
if(isImageRequest && !req.url?.startsWith('/staticImages/') {
return res.status(406).send({
message : 'Request for image at this URL is not supported'
});
}
next();
};
};