[Rt-commit] rt branch 5.0/fix-empty-updates-sending-emails-with-html-signatures created. rt-5.0.4-22-gc76da4910c

BPS Git Server git at git.bestpractical.com
Fri Jun 16 13:29:02 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/fix-empty-updates-sending-emails-with-html-signatures has been created
        at  c76da4910c353401bdc8ed184647d7a9717f4c86 (commit)

- Log -----------------------------------------------------------------
commit c76da4910c353401bdc8ed184647d7a9717f4c86
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Fri Jun 16 10:03:10 2023 -0300

    Fix empty updates sending emails with html signatures
    
    Most recent versions of CKEditor are escaping html differently than
    old FCKEditor. This commit fixes the StripContent method to strip
    and compare html in the new format.

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 9f543b050c..b72b2d5304 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1307,15 +1307,22 @@ sub StripContent {
     # Check for plaintext sig
     return '' if not $html and $content =~ /^(--)?\Q$sig\E$/;
 
-    # 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;
-    $sig =~ s/'/'/g;
-    return '' if $html and $content =~ m{^(?:<p>)?(--)?\Q$sig\E(?:</p>)?$}s;
+    if ($sig =~ /<.{1,5}>/) {
+        # HTML sig
+        $sig =~ s! !!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/&/&/g;
+        $sig =~ s/</</g;
+        $sig =~ s/>/>/g;
+        $sig =~ s/"/"/g;
+        $sig =~ s/'/'/g;
+        return '' if $html and $content =~ m{^(?:<p>)?(--)?\Q$sig\E(?:</p>)?$}s;
+    }
 
     # Pass it through
     return $return_content;

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list