libmime
Advanced tools
Comparing version 4.1.3 to 4.1.4
# Changelog | ||
## v4.1.4 2019-10-28 | ||
- decodeWords should also decode empty content part [WeiAnAn](9bbcfd2) | ||
- fix decode base64 ending with = [WeiAnAn](6e656e2) | ||
## v4.1.0 2019-05-01 | ||
@@ -4,0 +9,0 @@ |
@@ -226,3 +226,8 @@ /* eslint no-control-regex: 0, no-div-regex: 0, quotes: 0 */ | ||
} else if (encoding === 'B') { | ||
str = Buffer.from(str, 'base64'); | ||
str = Buffer.concat( | ||
str | ||
.split('=') | ||
.filter(s => s !== '') // filter empty string | ||
.map(str => Buffer.from(str, 'base64')) | ||
); | ||
} else { | ||
@@ -293,3 +298,3 @@ // keep as is, convert Buffer to unicode string, assume utf8 | ||
// find base64 words that can be joined | ||
.replace(/(=\?([^?]+)\?[Bb]\?[^?]+[^^=]\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]+\?=)/g, (match, left, chLeft, chRight) => { | ||
.replace(/(=\?([^?]+)\?[Bb]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g, (match, left, chLeft, chRight) => { | ||
// only mark b64 chunks to be joined if charsets match | ||
@@ -303,3 +308,3 @@ if (libcharset.normalizeCharset(chLeft || '') === libcharset.normalizeCharset(chRight || '')) { | ||
// find QP words that can be joined | ||
.replace(/(=\?([^?]+)\?[Qq]\?[^?]+\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]+\?=)/g, (match, left, chLeft, chRight) => { | ||
.replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g, (match, left, chLeft, chRight) => { | ||
// only mark QP chunks to be joined if charsets match | ||
@@ -315,5 +320,5 @@ if (libcharset.normalizeCharset(chLeft || '') === libcharset.normalizeCharset(chRight || '')) { | ||
// remove spaces between mime encoded words | ||
.replace(/(=\?[^?]+\?[QqBb]\?[^?]+\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]+\?=)/g, '$1') | ||
.replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g, '$1') | ||
// decode words | ||
.replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]+)\?=/g, (m, charset, encoding, text) => this.decodeWord(charset, encoding, text)) | ||
.replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g, (m, charset, encoding, text) => this.decodeWord(charset, encoding, text)) | ||
); | ||
@@ -320,0 +325,0 @@ } |
{ | ||
"name": "libmime", | ||
"description": "Encode and decode quoted printable and base64 strings", | ||
"version": "4.1.3", | ||
"version": "4.1.4", | ||
"main": "lib/libmime", | ||
@@ -22,4 +22,4 @@ "homepage": "https://github.com/andris9/libmime", | ||
"dependencies": { | ||
"iconv-lite": "0.4.24", | ||
"libbase64": "1.0.3", | ||
"iconv-lite": "0.5.0", | ||
"libbase64": "1.2.1", | ||
"libqp": "1.1.0" | ||
@@ -30,10 +30,10 @@ }, | ||
"eslint-config-nodemailer": "1.2.0", | ||
"eslint-config-prettier": "4.3.0", | ||
"eslint-config-prettier": "6.5.0", | ||
"grunt": "1.0.4", | ||
"grunt-cli": "1.3.2", | ||
"grunt-eslint": "21.0.0", | ||
"grunt-eslint": "22.0.0", | ||
"grunt-mocha-test": "0.13.3", | ||
"iconv": "^2.3.4", | ||
"mocha": "6.1.4" | ||
"iconv": "^2.3.5", | ||
"mocha": "6.2.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
144708
3174
+ Addediconv-lite@0.5.0(transitive)
+ Addedlibbase64@1.2.1(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedlibbase64@1.0.3(transitive)
Updatediconv-lite@0.5.0
Updatedlibbase64@1.2.1