fallback to jpg when no format detected (#296)

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
This commit is contained in:
Varun Gupta
2018-07-01 17:39:10 +05:30
committed by Jeffrey Warren
parent 510cf3421a
commit 0c0147354e
3 changed files with 25 additions and 3 deletions

View File

@@ -50148,7 +50148,18 @@ module.exports = function GetFormat(src) {
if (format === "jpeg") format = "jpg";
return format;
function validateFormat(data){
let supportedFormats = [
'jpg',
'jpeg',
'png',
'gif',
'canvas',
];
return supportedFormats.includes(data);
}
return validateFormat(format)?format:'jpg';
}