[Rt-commit] rt branch 5.0/whitelist-webpath-search-results created. rt-5.0.4-14-ga2b1aabeda

BPS Git Server git at git.bestpractical.com
Fri May 19 20:30:16 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/whitelist-webpath-search-results has been created
        at  a2b1aabeda91507b9f32d9f9df94492274b6304f (commit)

- Log -----------------------------------------------------------------
commit a2b1aabeda91507b9f32d9f9df94492274b6304f
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri May 19 11:05:52 2023 -0400

    Support WebPath configuration when checking ResultPage
    
    Previously the ResultPage check with WebPath set would
    still allow searches to work, but RT would log a warning
    each time. Add support for WebPath to correctly check
    ResultPage args.

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 0995a9e12a..9f543b050c 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -321,12 +321,19 @@ sub HandleRequest {
 
     if ( defined $ARGS->{ResultPage} && length $ARGS->{ResultPage}  ) {
         my $passed;
+        my $page = $ARGS->{ResultPage};
+
+        # Strip off web path
+        if ( my $web_path = RT->Config->Get('WebPath') ) {
+            $page =~ s!^$web_path!!;
+        }
+
         for my $item (@RT::Interface::Web::WHITELISTED_RESULT_PAGES) {
             if ( ref $item eq 'Regexp' ) {
-                $passed = 1 if $ARGS->{ResultPage} =~ $item;
+                $passed = 1 if $page =~ $item;
             }
             else {
-                $passed = 1 if $ARGS->{ResultPage} eq $item;
+                $passed = 1 if $page eq $item;
             }
             last if $passed;
         }

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list