Skip to content

Commit 77b88d8

Browse files
committed
Update mimelib.js
Removes 1 letter length requirement from decodeMimeWord. This enables decoding empty strings which sometimes may be sent out via mass mailers.
1 parent de03001 commit 77b88d8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/mimelib.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ module.exports.mimeFunctions = {
308308

309309
var fromCharset, encoding, match;
310310

311-
match = str.match(/^\=\?([\w_\-]+)\?([QqBb])\?([^\?]+)\?\=$/i);
311+
match = str.match(/^\=\?([\w_\-]+)\?([QqBb])\?([^\?]*)\?\=$/i);
312312
if (!match) {
313313
return convert(str, toCharset);
314314
}
@@ -332,8 +332,8 @@ module.exports.mimeFunctions = {
332332
var curCharset;
333333

334334
str = (str || "").toString().
335-
replace(/(=\?[^?]+\?[QqBb]\?[^?]+\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]+\?=)/g, "$1").
336-
replace(/\=\?([\w_\-]+)\?([QqBb])\?[^\?]+\?\=/g, (function(mimeWord, charset, encoding) {
335+
replace(/(=\?[^?]+\?[QqBb]\?[^?]+\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g, "$1").
336+
replace(/\=\?([\w_\-]+)\?([QqBb])\?[^\?]*\?\=/g, (function(mimeWord, charset, encoding) {
337337
curCharset = charset + encoding;
338338
return this.decodeMimeWord(mimeWord);
339339
}).bind(this));
@@ -581,4 +581,4 @@ function checkRanges(nr, ranges) {
581581
}
582582
}
583583
return false;
584-
}
584+
}

0 commit comments

Comments
 (0)