Skip to content

Commit

Permalink
fix(message-threading): Take non-standard but conventional subject pr…
Browse files Browse the repository at this point in the history
…efixes into account (#605)
  • Loading branch information
louis-lau authored Jan 25, 2024
1 parent 85e09ec commit 816114f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/message-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
})
Expand Down

0 comments on commit 816114f

Please sign in to comment.