mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-09-11 23:55:50 +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':
|
case 'text':
|
||||||
return this.processTextNode(node, options);
|
return this.processTextNode(node, options);
|
||||||
case 'message':
|
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) {
|
if (!options.attachmentRFC822) {
|
||||||
return this.processRFC822Node(node, options);
|
return this.processRFC822Node(node, options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,8 +107,22 @@ class MIMEParser {
|
||||||
* from the tree (circular references prohibit conversion to JSON)
|
* from the tree (circular references prohibit conversion to JSON)
|
||||||
*/
|
*/
|
||||||
finalizeTree() {
|
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 => {
|
let walker = node => {
|
||||||
if (node.body) {
|
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.lineCount = node.body.length;
|
||||||
node.body = Buffer.from(
|
node.body = Buffer.from(
|
||||||
node.body.join('').
|
node.body.join('').
|
||||||
|
|
Loading…
Add table
Reference in a new issue