mailparser
Advanced tools
Comparing version 2.7.1 to 2.7.2
@@ -51,2 +51,8 @@ 'use strict'; | ||
super(); | ||
// Iconv throws error on ks_c_5601-1987 when it is mapped to EUC-KR | ||
// https://github.com/bnoordhuis/node-iconv/issues/169 | ||
if (charset === 'ks_c_5601-1987') { | ||
charset = 'CP949'; | ||
} | ||
this.stream = new Iconv(charset, 'UTF-8//TRANSLIT//IGNORE'); | ||
@@ -181,2 +187,6 @@ | ||
this.finished = true; | ||
if (this.curnode && this.curnode.decoder) { | ||
this.curnode.decoder.end(); | ||
} | ||
if (typeof this.waitingEnd === 'function') { | ||
@@ -207,3 +217,5 @@ this.waitingEnd(); | ||
this.waitingEnd = () => { | ||
this.cleanup(done); | ||
this.cleanup(() => { | ||
done(); | ||
}); | ||
}; | ||
@@ -218,2 +230,3 @@ } | ||
}; | ||
if (this.curnode && this.curnode.decoder && this.curnode.decoder.readable && !this.decoderEnded) { | ||
@@ -288,3 +301,3 @@ (this.curnode.contentStream || this.curnode.decoder).once('end', () => { | ||
case 'return-path': | ||
value = addressparser(value); | ||
value = addressparser(this.libmime.decodeWords(value)); | ||
this.decodeAddresses(value); | ||
@@ -506,3 +519,5 @@ value = { | ||
} | ||
decoder.on('end', () => (this.decoderEnded = true)); | ||
decoder.on('end', () => { | ||
this.decoderEnded = true; | ||
}); | ||
newNode.decoder = decoder; | ||
@@ -647,3 +662,5 @@ } | ||
if ((!alternative && this.hasText) || (node.root && !this.hasText)) { | ||
if (node.textContent.length > this.options.maxHtmlLengthToParse) { | ||
if (this.options.skipHtmlToText) { | ||
text.push(''); | ||
} else if (node.textContent.length > this.options.maxHtmlLengthToParse) { | ||
this.emit('error', new Error(`HTML too long for parsing ${node.textContent.length} bytes`)); | ||
@@ -738,3 +755,16 @@ text.push('Invalid HTML content (too long)'); | ||
}); | ||
node.decoder.pipe(hasher); | ||
node.decoder.on('readable', () => { | ||
let chunk; | ||
while ((chunk = node.decoder.read()) !== null) { | ||
hasher.write(chunk); | ||
} | ||
}); | ||
node.decoder.once('end', () => { | ||
hasher.end(); | ||
}); | ||
//node.decoder.pipe(hasher); | ||
attachment.content = hasher; | ||
@@ -741,0 +771,0 @@ |
@@ -41,2 +41,3 @@ 'use strict'; | ||
let data = parser.read(); | ||
if (data === null) { | ||
@@ -108,7 +109,13 @@ reading = false; | ||
if (typeof input === 'string') { | ||
parser.end(Buffer.from(input)); | ||
parser.end(Buffer.from(input, 'binary')); | ||
} else if (Buffer.isBuffer(input)) { | ||
parser.end(input); | ||
} else { | ||
input.pipe(parser); | ||
input | ||
.once('error', err => { | ||
input.destroy(); | ||
parser.destroy(); | ||
callback(err); | ||
}) | ||
.pipe(parser); | ||
} | ||
@@ -115,0 +122,0 @@ |
{ | ||
"name": "mailparser", | ||
"version": "2.7.1", | ||
"version": "2.7.2", | ||
"description": "Parse e-mails", | ||
@@ -21,20 +21,20 @@ "main": "index.js", | ||
"html-to-text": "5.1.1", | ||
"iconv-lite": "0.4.24", | ||
"libmime": "4.1.1", | ||
"linkify-it": "2.1.0", | ||
"iconv-lite": "0.5.0", | ||
"libmime": "4.1.4", | ||
"linkify-it": "2.2.0", | ||
"mailsplit": "4.4.1", | ||
"nodemailer": "6.1.1", | ||
"nodemailer": "6.3.1", | ||
"tlds": "1.203.1" | ||
}, | ||
"devDependencies": { | ||
"ajv": "6.10.0", | ||
"eslint": "5.16.0", | ||
"ajv": "6.10.2", | ||
"eslint": "6.6.0", | ||
"eslint-config-nodemailer": "1.2.0", | ||
"eslint-config-prettier": "4.2.0", | ||
"eslint-config-prettier": "6.5.0", | ||
"grunt": "1.0.4", | ||
"grunt-cli": "1.3.2", | ||
"grunt-contrib-nodeunit": "2.0.0", | ||
"grunt-eslint": "21.0.0", | ||
"iconv": "2.3.4", | ||
"libbase64": "1.0.3", | ||
"grunt-eslint": "22.0.0", | ||
"iconv": "2.3.5", | ||
"libbase64": "1.2.1", | ||
"libqp": "1.1.0", | ||
@@ -41,0 +41,0 @@ "random-message": "1.1.0" |
58284
1094
+ Addediconv-lite@0.5.0(transitive)
+ Addedlibbase64@1.2.1(transitive)
+ Addedlibmime@4.1.4(transitive)
+ Addedlinkify-it@2.2.0(transitive)
+ Addednodemailer@6.3.1(transitive)
- Removedlinkify-it@2.1.0(transitive)
- Removednodemailer@6.1.1(transitive)
Updatediconv-lite@0.5.0
Updatedlibmime@4.1.4
Updatedlinkify-it@2.2.0
Updatednodemailer@6.3.1