throws an error when formating is invalid

This commit is contained in:
Brian Whitney 2018-12-19 11:22:11 -05:00
parent fe6b6c8f47
commit 343541981f

View File

@ -231,18 +231,21 @@ class Mime {
* @returns {string}
*/
static _decodeMimeData(input, charEnc, contEnc) {
switch (contEnc) {
case "base64":
input = Utils.convertToByteArray(input, "base64");
break;
case "quoted-printable":
input = decodeQuotedPrintable(input);
try {
switch (contEnc) {
case "base64":
input = Utils.convertToByteArray(input, "base64");
break;
case "quoted-printable":
input = decodeQuotedPrintable(input);
}
if (charEnc && MIME_FORMAT.hasOwnProperty(charEnc.toLowerCase())) {
input = Utils.strToByteArray(cptable.utils.decode(MIME_FORMAT[charEnc.toLowerCase()], input));
}
return input;
} catch (err) {
throw new OperationError("Invalid Mime Format");
}
if (charEnc && MIME_FORMAT.hasOwnProperty(charEnc.toLowerCase())) {
input = Utils.strToByteArray(cptable.utils.decode(MIME_FORMAT[charEnc.toLowerCase()], input));
}
return input;
}
/**