Open toberndo opened 9 years ago
:+1: thx for pointing it out. sounds like this error bubbles up from the mimeparser. will be in berlin the next couple of days, so ... patches welcome ;)
Not yet a patch, but I found the place (in mailreader-parser.js):
function matchText(node, bodyPart) {
var disposition = node.headers['content-disposition'],
isText = (/^text\/plain/i.test(node.contentType.value) && (!disposition || (disposition && disposition[0].value !== 'attachment')));
if (!isText) {
return false;
}
var content = new TextDecoder('utf-8').decode(node.content).replace(/([\r]?\n)*$/g, '');
if (bodyPart.type === 'text') {
// this mime node is the text node we gave to the mimeparser
bodyPart.content = content;
} else {
// this mime node is part of a signed or encrypted node
bodyPart.content.push({
type: 'text',
content: content
});
}
return true;
}
node.content
is an empty string and therefore new TextDecoder('utf-8').decode('')
throws an exception.
I think the content
property is not an empty string but it is missing from the object entirely (as there were no body in the node) and thus undefined
is used for decoding
I see an empty string:
A bit of an edge case, but parsing of a message with an empty body:
leads to the exception:
Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'