mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-01-07 16:38:17 +08:00
fix parsing when root node is message/rfc822
This commit is contained in:
parent
963965c86c
commit
31fe3c7442
2 changed files with 15 additions and 1 deletions
|
@ -38,7 +38,7 @@ class BodyStructure {
|
|||
case 'text':
|
||||
return this.processTextNode(node, options);
|
||||
case 'message':
|
||||
if (node.parsedHeader['content-type'].subtype === 'rfc822' && !/attachment/i.test(node.parsedHeader['content-disposition'])) {
|
||||
if (node.parsedHeader['content-type'].subtype === 'rfc822') {
|
||||
if (!options.attachmentRFC822) {
|
||||
return this.processRFC822Node(node, options);
|
||||
}
|
||||
|
|
|
@ -107,8 +107,22 @@ class MIMEParser {
|
|||
* from the tree (circular references prohibit conversion to JSON)
|
||||
*/
|
||||
finalizeTree() {
|
||||
|
||||
if (this._node.state === 'header') {
|
||||
this.processNodeHeader();
|
||||
this.processContentType();
|
||||
}
|
||||
|
||||
if (this.tree.parsedHeader && this.tree.parsedHeader['content-type'].value === 'message/rfc822') {
|
||||
this.tree.message = parse(this.tree.body.join(''));
|
||||
}
|
||||
|
||||
let walker = node => {
|
||||
if (node.body) {
|
||||
if (node.parentNode === this.tree && node.parsedHeader['content-type'].value === 'message/rfc822') {
|
||||
node.message = parse(node.body.join(''));
|
||||
}
|
||||
|
||||
node.lineCount = node.body.length;
|
||||
node.body = Buffer.from(
|
||||
node.body.join('').
|
||||
|
|
Loading…
Reference in a new issue