[Rt-commit] rt branch 5.0/tweak-query-comparison-in-menu created. rt-5.0.4-20-gdb5dba3ebc

BPS Git Server git at git.bestpractical.com
Thu Jun 1 19:48:54 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/tweak-query-comparison-in-menu has been created
        at  db5dba3ebc2f82d520a71e2a5350fde22fb29511 (commit)

- Log -----------------------------------------------------------------
commit db5dba3ebc2f82d520a71e2a5350fde22fb29511
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Jun 1 19:40:11 2023 +0800

    Get query string from REQUEST_URI for correctness and also better performance
    
    CGI::query_string assembles query string from parameters, which is
    usually fine(for GET) but the parameters could contain POST data, which
    we want to exclude here.
    
    Parsing query string from REQUEST_URI is faster especially when it's a
    POST request that contains big data.

diff --git a/lib/RT/Interface/Web/Menu.pm b/lib/RT/Interface/Web/Menu.pm
index 4b24db2db6..5acb9ea290 100644
--- a/lib/RT/Interface/Web/Menu.pm
+++ b/lib/RT/Interface/Web/Menu.pm
@@ -237,7 +237,7 @@ sub child {
         # Activate it
         if ( defined $path and length $path ) {
             my $base_path = $HTML::Mason::Commands::r->path_info;
-            my $query     = $HTML::Mason::Commands::m->cgi_object->query_string;
+            my $query     = URI->new(RT::Interface::Web::RequestENV('REQUEST_URI'))->query;
             $base_path =~ s!/+!/!g;
             $base_path .= "?$query" if defined $query and length $query;
 
diff --git a/t/api/menu.t b/t/api/menu.t
index a9cda69c71..9171b69211 100644
--- a/t/api/menu.t
+++ b/t/api/menu.t
@@ -17,9 +17,9 @@ sub child_path_is($$$) {
     sub path_info { "" }
 
     package FakeInterp;
-    require CGI;
+    require CGI::PSGI;
     sub new { bless {}, shift }
-    sub cgi_object { CGI->new }
+    sub cgi_object { CGI::PSGI->new({ REQUEST_URI => '' }) }
 }
 
 local $HTML::Mason::Commands::r = FakeRequest->new;

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list