mailparser 3.6.2 → 3.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/mail-parser.js +21 -12
- package/package.json +9 -9
package/lib/mail-parser.js
CHANGED
|
@@ -273,8 +273,13 @@ class MailParser extends Transform {
|
|
|
273
273
|
|
|
274
274
|
cleanup(done) {
|
|
275
275
|
let finish = () => {
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
try {
|
|
277
|
+
let t = this.getTextContent();
|
|
278
|
+
this.push(t);
|
|
279
|
+
} catch (err) {
|
|
280
|
+
return this.emit('error', err);
|
|
281
|
+
}
|
|
282
|
+
|
|
278
283
|
done();
|
|
279
284
|
};
|
|
280
285
|
|
|
@@ -504,14 +509,18 @@ class MailParser extends Transform {
|
|
|
504
509
|
}
|
|
505
510
|
|
|
506
511
|
decodeAddresses(addresses) {
|
|
512
|
+
let processedAddress = new WeakSet();
|
|
507
513
|
for (let i = 0; i < addresses.length; i++) {
|
|
508
514
|
let address = addresses[i];
|
|
509
515
|
address.name = (address.name || '').toString().trim();
|
|
510
516
|
|
|
511
|
-
if (!address.address && /^(=\?([^?]+)\?[Bb]\?[^?]*\?=)(\s*=\?([^?]+)\?[Bb]\?[^?]*\?=)*$/.test(address.name)) {
|
|
517
|
+
if (!address.address && /^(=\?([^?]+)\?[Bb]\?[^?]*\?=)(\s*=\?([^?]+)\?[Bb]\?[^?]*\?=)*$/.test(address.name) && !processedAddress.has(address)) {
|
|
512
518
|
let parsed = addressparser(this.libmime.decodeWords(address.name));
|
|
513
519
|
if (parsed.length) {
|
|
514
|
-
parsed.forEach(entry =>
|
|
520
|
+
parsed.forEach(entry => {
|
|
521
|
+
processedAddress.add(entry);
|
|
522
|
+
addresses.push(entry);
|
|
523
|
+
});
|
|
515
524
|
}
|
|
516
525
|
|
|
517
526
|
// remove current element
|
|
@@ -749,9 +758,11 @@ class MailParser extends Transform {
|
|
|
749
758
|
}
|
|
750
759
|
}
|
|
751
760
|
alternative = alternative || node.contentType === 'multipart/alternative';
|
|
752
|
-
node.children
|
|
753
|
-
|
|
754
|
-
|
|
761
|
+
if (node.children) {
|
|
762
|
+
node.children.forEach(subNode => {
|
|
763
|
+
processNode(alternative, level + 1, subNode);
|
|
764
|
+
});
|
|
765
|
+
}
|
|
755
766
|
};
|
|
756
767
|
|
|
757
768
|
processNode(false, 0, this.tree);
|
|
@@ -1038,11 +1049,9 @@ class MailParser extends Transform {
|
|
|
1038
1049
|
html.replace(/\bcid:([^'"\s]{1,256})/g, (match, cid) => {
|
|
1039
1050
|
for (let i = 0, len = this.attachmentList.length; i < len; i++) {
|
|
1040
1051
|
if (this.attachmentList[i].cid === cid && /^image\/[\w]+$/i.test(this.attachmentList[i].contentType)) {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
});
|
|
1045
|
-
}
|
|
1052
|
+
cids.set(cid, {
|
|
1053
|
+
attachment: this.attachmentList[i]
|
|
1054
|
+
});
|
|
1046
1055
|
break;
|
|
1047
1056
|
}
|
|
1048
1057
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mailparser",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.4",
|
|
4
4
|
"description": "Parse e-mails",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,20 +18,20 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"encoding-japanese": "2.0.0",
|
|
20
20
|
"he": "1.2.0",
|
|
21
|
-
"html-to-text": "9.0.
|
|
21
|
+
"html-to-text": "9.0.4",
|
|
22
22
|
"iconv-lite": "0.6.3",
|
|
23
|
-
"libmime": "5.2.
|
|
23
|
+
"libmime": "5.2.1",
|
|
24
24
|
"linkify-it": "4.0.1",
|
|
25
25
|
"mailsplit": "5.4.0",
|
|
26
|
-
"nodemailer": "6.
|
|
27
|
-
"tlds": "1.
|
|
26
|
+
"nodemailer": "6.9.1",
|
|
27
|
+
"tlds": "1.236.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"ajv": "8.
|
|
31
|
-
"eslint": "8.
|
|
30
|
+
"ajv": "8.12.0",
|
|
31
|
+
"eslint": "8.35.0",
|
|
32
32
|
"eslint-config-nodemailer": "1.2.0",
|
|
33
|
-
"eslint-config-prettier": "8.
|
|
34
|
-
"grunt": "1.
|
|
33
|
+
"eslint-config-prettier": "8.6.0",
|
|
34
|
+
"grunt": "1.6.1",
|
|
35
35
|
"grunt-cli": "1.4.3",
|
|
36
36
|
"grunt-contrib-nodeunit": "4.0.0",
|
|
37
37
|
"grunt-eslint": "24.0.1",
|