[Rt-commit] rt branch, 4.2/rename-escapeutf8, created. rt-4.1.5-6-gaab36cf

Alex Vandiver alexmv at bestpractical.com
Thu Dec 6 15:21:37 EST 2012


The branch, 4.2/rename-escapeutf8 has been created
        at  aab36cfc6e53435cef2f439eff1576e9cc008be2 (commit)

- Log -----------------------------------------------------------------
commit aab36cfc6e53435cef2f439eff1576e9cc008be2
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Dec 6 15:21:09 2012 -0500

    Rename EscapeUTF8 to the more correctly descriptive EscapeHTML

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index c477b00..6fd247a 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -112,13 +112,13 @@ sub ClearSquished {
     %SQUISHED_CSS = ();
 }
 
-=head2 EscapeUTF8 SCALARREF
+=head2 EscapeHTML SCALARREF
 
 does a css-busting but minimalist escaping of whatever html you're passing in.
 
 =cut
 
-sub EscapeUTF8 {
+sub EscapeHTML {
     my $ref = shift;
     return unless defined $$ref;
 
@@ -131,7 +131,12 @@ sub EscapeUTF8 {
     $$ref =~ s/'/'/g;
 }
 
-
+# Back-compat
+# XXX: Remove in 4.4
+sub EscapeUTF8 {
+    RT->Logger->warning("EscapeUTF8 is deprecated; use EscapeHTML at @{[join '/', caller]}");
+    EscapeHTML(@_);
+}
 
 =head2 EscapeURI SCALARREF
 
diff --git a/lib/RT/Interface/Web/Handler.pm b/lib/RT/Interface/Web/Handler.pm
index 5af3025..3aa9bf2 100644
--- a/lib/RT/Interface/Web/Handler.pm
+++ b/lib/RT/Interface/Web/Handler.pm
@@ -114,7 +114,7 @@ sub NewHandler {
         @_
     );
   
-    $handler->interp->set_escape( h => \&RT::Interface::Web::EscapeUTF8 );
+    $handler->interp->set_escape( h => \&RT::Interface::Web::EscapeHTML );
     $handler->interp->set_escape( u => \&RT::Interface::Web::EscapeURI  );
     $handler->interp->set_escape( j => \&RT::Interface::Web::EscapeJS   );
     return($handler);
diff --git a/lib/RT/Test/Web.pm b/lib/RT/Test/Web.pm
index 4952e59..831ad99 100644
--- a/lib/RT/Test/Web.pm
+++ b/lib/RT/Test/Web.pm
@@ -115,7 +115,7 @@ sub logged_in_as {
         Test::More::diag( "error: status is ". $self->status );
         return 0;
     }
-    RT::Interface::Web::EscapeUTF8(\$user);
+    RT::Interface::Web::EscapeHTML(\$user);
     unless ( $self->content =~ m{<span class="current-user">\Q$user\E</span>}i ) {
         Test::More::diag("Page has no user name");
         return 0;
diff --git a/share/html/Admin/Tools/Configuration.html b/share/html/Admin/Tools/Configuration.html
index 5a45420..3dd1f3d 100644
--- a/share/html/Admin/Tools/Configuration.html
+++ b/share/html/Admin/Tools/Configuration.html
@@ -310,7 +310,7 @@ local $Data::Dumper::Indent = 2;
 sub stringify {
     my $value = shift;
     my $output = Dumper $value;
-    RT::Interface::Web::EscapeUTF8(\$output);
+    RT::Interface::Web::EscapeHTML(\$output);
     $output =~ s/ / /g;
     $output =~ s!\n!<br />!g;
     return $output;
diff --git a/share/html/Elements/MakeClicky b/share/html/Elements/MakeClicky
index 57964f7..18d9348 100644
--- a/share/html/Elements/MakeClicky
+++ b/share/html/Elements/MakeClicky
@@ -91,7 +91,7 @@ my $handle = sub {
 
 my $escaper = sub {
     my $content = shift;
-    RT::Interface::Web::EscapeUTF8( \$content );
+    RT::Interface::Web::EscapeHTML( \$content );
     return $content;
 };
 
@@ -131,7 +131,7 @@ $html => undef
 <%INIT>
 return unless defined $$content;
 unless ( $regexp ) {
-    RT::Interface::Web::EscapeUTF8( $content ) unless $html;
+    RT::Interface::Web::EscapeHTML( $content ) unless $html;
     return;
 }
 
diff --git a/t/web/googleish_search.t b/t/web/googleish_search.t
index a5f834e..eb5bdcf 100644
--- a/t/web/googleish_search.t
+++ b/t/web/googleish_search.t
@@ -188,7 +188,7 @@ for my $quote ( q{'}, q{"} ) {
         $m->field( q => $q );
         $m->submit;
         my $escape_quote = $quote;
-        RT::Interface::Web::EscapeUTF8(\$escape_quote);
+        RT::Interface::Web::EscapeHTML(\$escape_quote);
         $m->content_contains( "base${escape_quote}ticket",
             "base${quote}ticket is found" );
     }
diff --git a/t/web/saved_search_permissions.t b/t/web/saved_search_permissions.t
index f61c931..e24ae61 100644
--- a/t/web/saved_search_permissions.t
+++ b/t/web/saved_search_permissions.t
@@ -26,7 +26,7 @@ ok( $m->login( 'foo', 'foobar', logout => 1 ), 'logged in' );
 $m->get_ok( $url . "/Search/Build.html?SavedSearchLoad=$id" );
 
 my $message = qq{Can not load saved search "$id"};
-RT::Interface::Web::EscapeUTF8( \$message );
+RT::Interface::Web::EscapeHTML( \$message );
 $m->content_contains( $message, 'user foo can not load saved search of root' );
 
 $m->warning_like( qr/User #\d+ tried to load container user #\d+/,

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


More information about the Rt-commit mailing list