Skip to content

Commit c8f3ff1

Browse files
committed
fix: preserve angle-bracketed emails (Name <a@b>) from HTML tag stripper
Teams users pasting addresses in RFC-5322 mailbox form (e.g. from Outlook) produced messages where the bot silently extracted zero emails, because <email@domain> was matched and removed by the generic <[^>]+> tag stripper before the email regex ran. Tighten the stripper to skip <...> spans that contain an @, since real HTML tags never do.
1 parent 865b472 commit c8f3ff1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function decodeEntities(text) {
2727
function stripMarkup(text) {
2828
return decodeEntities(text)
2929
.replace(/<at[^>]*>.*?<\/at>/gi, ' ')
30-
.replace(/<[^>]+>/g, ' ')
30+
.replace(/<(?![^>]*@)[^>]+>/g, ' ')
3131
.replace(TLD_GLUE_RE, '.$1 ');
3232
}
3333

0 commit comments

Comments
 (0)