Skip to content

Commit

Permalink
Fix empty updates sending emails with html signatures
Browse files Browse the repository at this point in the history
This commit fixes the StripContent method to strip and compare html for
html signatures.
  • Loading branch information
richieri-bps authored and sunnavy committed Jun 16, 2023
1 parent 0ff936e commit d75b754
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions lib/RT/Interface/Web.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1310,12 +1310,23 @@ sub StripContent {
# Check for html-formatted sig; we don't use EscapeHTML here
# because we want to precisely match the escapting that FCKEditor
# uses.
$sig =~ s/&/&/g;
$sig =~ s/</&lt;/g;
$sig =~ s/>/&gt;/g;
$sig =~ s/"/&quot;/g;
$sig =~ s/'/&#39;/g;
return '' if $html and $content =~ m{^(?:<p>)?(--)?\Q$sig\E(?:</p>)?$}s;

if ($sig =~ /<.{1,5}>/) {
# HTML sig
$sig =~ s!&nbsp;!!g;
$sig =~ s!<br/?>!!g;
return ''
if $html
and $content =~ m{^(?:<p>)?(--)(?:<\/p>)?\Q$sig\E(?:</p>)?$}s;
} else {
# Backwards compatibility for old plaintext sigs in html content
$sig =~ s/&/&amp;/g;
$sig =~ s/</&lt;/g;
$sig =~ s/>/&gt;/g;
$sig =~ s/"/&quot;/g;
$sig =~ s/'/&#39;/g;
return '' if $html and $content =~ m{^(?:<p>)?(--)?\Q$sig\E(?:</p>)?$}s;
}

# Pass it through
return $return_content;
Expand Down

0 comments on commit d75b754

Please sign in to comment.