removing 'jpeg' as valid format and no checking agains lowercase

This commit is contained in:
Simon Martín 2018-05-16 12:00:40 +02:00
parent ad4ed7a06b
commit 56aa1b39f0

View File

@ -1,8 +1,8 @@
const VALID_IMAGE_FORMATS = ['png', 'jpg', 'jpeg'];
const VALID_IMAGE_FORMATS = ['png', 'jpg'];
module.exports = function checkStaticImageFormat () {
return function checkStaticImageFormatMiddleware (req, res, next) {
if(!VALID_IMAGE_FORMATS.includes(req.params.format.toLowerCase())) {
if(!VALID_IMAGE_FORMATS.includes(req.params.format)) {
return next(new Error(`Unsupported image format "${req.params.format}"`));
}