From d75b754308f0f8287a31426c19dcb6facdb1db47 Mon Sep 17 00:00:00 2001 From: Ronaldo Richieri Date: Fri, 16 Jun 2023 10:03:10 -0300 Subject: [PATCH] Fix empty updates sending emails with html signatures This commit fixes the StripContent method to strip and compare html for html signatures. --- lib/RT/Interface/Web.pm | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm index 9f543b050ce..385d849716f 100644 --- a/lib/RT/Interface/Web.pm +++ b/lib/RT/Interface/Web.pm @@ -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//>/g; - $sig =~ s/"/"/g; - $sig =~ s/'/'/g; - return '' if $html and $content =~ m{^(?:

)?(--)?\Q$sig\E(?:

)?$}s; + + if ($sig =~ /<.{1,5}>/) { + # HTML sig + $sig =~ s! !!g; + $sig =~ s!
!!g; + return '' + if $html + and $content =~ m{^(?:

)?(--)(?:<\/p>)?\Q$sig\E(?:

)?$}s; + } else { + # Backwards compatibility for old plaintext sigs in html content + $sig =~ s/&/&/g; + $sig =~ s//>/g; + $sig =~ s/"/"/g; + $sig =~ s/'/'/g; + return '' if $html and $content =~ m{^(?:

)?(--)?\Q$sig\E(?:

)?$}s; + } # Pass it through return $return_content;