Skip to content

Commit 2c8aeb1

Browse files
author
Gal Falkon
committed
Better handling for Gmail's "plusreply" links
Gmail adds links with a 'gmail_plusreply' class when tagging someone on an email. Trying to leave these intact. Otherwise, rendering deletes some of the attributes of these links (e.g. id) causing Gmail to remove the new recipients (sometimes).
1 parent 3efea51 commit 2c8aeb1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/common/mdh-html-to-text.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ MdhHtmlToText.prototype._preprocess = function() {
105105
// to remain intact.
106106
this.excludeTagBlocks('blockquote', true);
107107

108+
// Try to leave intact the links that Gmail adds when tagging someone on an email
109+
this.preprocessInfo.html = this.preprocessInfo.html.replace(
110+
/<a (class="gmail_plusreply"[^>]+)>([^<]*)<\/a>/ig,
111+
'&lt;a $1&gt;$2&lt;\/a&gt;'
112+
);
113+
108114
// Try to leave intact the line that Gmail adds that says:
109115
// On such-a-date, such-a-person <email addy> wrote:
110116
this.preprocessInfo.html = this.preprocessInfo.html.replace(

0 commit comments

Comments
 (0)