mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-09-20 07:16:05 +08:00
fix(message-threading): Take non-standard but conventional subject prefixes into account (#605)
This commit is contained in:
parent
85e09ecc77
commit
816114f655
|
@ -1456,12 +1456,13 @@ class MessageHandler {
|
|||
options = options || {};
|
||||
subject = subject.replace(/\s+/g, ' ').trim();
|
||||
|
||||
// `Re: [EXTERNAL] Re: Fwd: Example subject (fwd)` becomes `Example subject`
|
||||
if (options.removePrefix) {
|
||||
let match = true;
|
||||
while (match) {
|
||||
match = false;
|
||||
subject = subject
|
||||
.replace(/^(re|fwd?)\s*:|\s*\(fwd\)\s*$/gi, () => {
|
||||
.replace(/^(re|fwd?)\s*:|^\[.+?\](?=\s.+)|\s*\(fwd\)\s*$/gi, () => {
|
||||
match = true;
|
||||
return '';
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue