Comparing version 4.3.1 to 4.4.0
@@ -15,8 +15,10 @@ 'use strict'; | ||
class FlowedDecoder extends Transform { | ||
constructor(options) { | ||
constructor(config) { | ||
super(); | ||
this.options = options || {}; | ||
this.config = config || {}; | ||
this.chunks = []; | ||
this.chunklen = 0; | ||
this.libmime = new libmime.Libmime({ Iconv: config.Iconv }); | ||
} | ||
@@ -43,7 +45,7 @@ | ||
if (this.options.encoding === 'base64') { | ||
if (this.config.encoding === 'base64') { | ||
currentBody = Buffer.from(currentBody.toString('binary'), 'base64'); | ||
} | ||
let content = libmime.decodeFlowed(currentBody.toString('binary'), this.options.delSp); | ||
let content = this.libmime.decodeFlowed(currentBody.toString('binary'), this.config.delSp); | ||
this.push(Buffer.from(content, 'binary')); | ||
@@ -50,0 +52,0 @@ } |
@@ -10,3 +10,5 @@ 'use strict'; | ||
class Headers { | ||
constructor(headers) { | ||
constructor(headers, config) { | ||
config = config || {}; | ||
if (Array.isArray(headers)) { | ||
@@ -27,2 +29,4 @@ // already using parsed headers | ||
this.http = false; | ||
this.libmime = new libmime.Libmime({ Iconv: config.Iconv }); | ||
} | ||
@@ -42,3 +46,3 @@ | ||
return this.get(key) | ||
.map(line => libmime.decodeHeader(line)) | ||
.map(line => this.libmime.decodeHeader(line)) | ||
.filter(line => line && line.value); | ||
@@ -56,3 +60,3 @@ } | ||
} | ||
return ((libmime.decodeHeader(header.line) || {}).value || '').toString().trim(); | ||
return ((this.libmime.decodeHeader(header.line) || {}).value || '').toString().trim(); | ||
} | ||
@@ -81,3 +85,3 @@ | ||
value = value.toString('binary'); | ||
this.addFormatted(key, libmime.foldLines(key + ': ' + value.replace(/\r?\n/g, ''), 76, false), index); | ||
this.addFormatted(key, this.libmime.foldLines(key + ': ' + value.replace(/\r?\n/g, ''), 76, false), index); | ||
} | ||
@@ -84,0 +88,0 @@ |
@@ -416,3 +416,3 @@ 'use strict'; | ||
newNode(parent) { | ||
this.node = new MimeNode(parent || false); | ||
this.node = new MimeNode(parent || false, this.config); | ||
this.state = HEAD; | ||
@@ -419,0 +419,0 @@ this.nodeCounter++; |
@@ -10,3 +10,3 @@ 'use strict'; | ||
class MimeNode { | ||
constructor(parentNode) { | ||
constructor(parentNode, config) { | ||
this.type = 'node'; | ||
@@ -29,2 +29,5 @@ this.root = !parentNode; | ||
this.delSp = false; | ||
this.config = config || {}; | ||
this.libmime = new libmime.Libmime({ Iconv: this.config.Iconv }); | ||
} | ||
@@ -44,5 +47,5 @@ | ||
} | ||
this.headers = new Headers(Buffer.concat(this._headersLines, this._headerlen)); | ||
this._parsedContentType = libmime.parseHeaderValue(this.headers.getFirst('Content-Type')); | ||
this._parsedContentDisposition = libmime.parseHeaderValue(this.headers.getFirst('Content-Disposition')); | ||
this.headers = new Headers(Buffer.concat(this._headersLines, this._headerlen), this.config); | ||
this._parsedContentType = this.libmime.parseHeaderValue(this.headers.getFirst('Content-Type')); | ||
this._parsedContentDisposition = this.libmime.parseHeaderValue(this.headers.getFirst('Content-Disposition')); | ||
@@ -68,3 +71,3 @@ this.encoding = this.headers | ||
try { | ||
this.filename = libmime.decodeWords(this.filename); | ||
this.filename = this.libmime.decodeWords(this.filename); | ||
} catch (E) { | ||
@@ -108,3 +111,3 @@ // failed to parse filename, keep as is (most probably an unknown charset is used) | ||
this.headers.update('Content-Type', libmime.buildHeaderValue(this._parsedContentType)); | ||
this.headers.update('Content-Type', this.libmime.buildHeaderValue(this._parsedContentType)); | ||
} | ||
@@ -137,3 +140,3 @@ | ||
this.headers.update('Content-Type', libmime.buildHeaderValue(this._parsedContentType)); | ||
this.headers.update('Content-Type', this.libmime.buildHeaderValue(this._parsedContentType)); | ||
} | ||
@@ -150,3 +153,3 @@ | ||
delete this._parsedContentType.params.name; | ||
this.headers.update('Content-Type', libmime.buildHeaderValue(this._parsedContentType)); | ||
this.headers.update('Content-Type', this.libmime.buildHeaderValue(this._parsedContentType)); | ||
} | ||
@@ -168,3 +171,3 @@ | ||
this.headers.update('Content-Disposition', libmime.buildHeaderValue(this._parsedContentDisposition)); | ||
this.headers.update('Content-Disposition', this.libmime.buildHeaderValue(this._parsedContentDisposition)); | ||
} | ||
@@ -171,0 +174,0 @@ |
{ | ||
"name": "mailsplit", | ||
"version": "4.3.1", | ||
"version": "4.4.0", | ||
"description": "Split email messages into an object stream", | ||
@@ -15,3 +15,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"libmime": "4.0.1", | ||
"libmime": "4.1.0", | ||
"libbase64": "1.0.3", | ||
@@ -21,5 +21,5 @@ "libqp": "1.1.0" | ||
"devDependencies": { | ||
"eslint": "5.15.3", | ||
"eslint": "5.16.0", | ||
"eslint-config-nodemailer": "1.2.0", | ||
"eslint-config-prettier": "4.1.0", | ||
"eslint-config-prettier": "4.2.0", | ||
"grunt": "1.0.4", | ||
@@ -26,0 +26,0 @@ "grunt-cli": "1.3.2", |
Sorry, the diff of this file is not supported yet
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
2
1057
64987
+ Addediconv-lite@0.4.24(transitive)
+ Addedlibmime@4.1.0(transitive)
- Removediconv-lite@0.4.23(transitive)
- Removedlibmime@4.0.1(transitive)
Updatedlibmime@4.1.0