about summary refs log tree commit homepage
path: root/lib/PublicInbox/Repobrowse.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-01-20 22:17:37 +0000
committerEric Wong <e@80x24.org>2016-04-05 18:58:27 +0000
commitb3bc0d722aacdad5ac5e8ee7c32bda9c87d3052b (patch)
treea9caf00950eacb8a63d4c1b482dcddeba6067d41 /lib/PublicInbox/Repobrowse.pm
parente90aa39b6447ceef78d31d4c68291585eb02244a (diff)
downloadpublic-inbox-b3bc0d722aacdad5ac5e8ee7c32bda9c87d3052b.tar.gz
We need to preserve the query string to avoid breakage.
Diffstat (limited to 'lib/PublicInbox/Repobrowse.pm')
-rw-r--r--lib/PublicInbox/Repobrowse.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/PublicInbox/Repobrowse.pm b/lib/PublicInbox/Repobrowse.pm
index cc18255d..219b44d6 100644
--- a/lib/PublicInbox/Repobrowse.pm
+++ b/lib/PublicInbox/Repobrowse.pm
@@ -52,10 +52,14 @@ sub no_tslash {
                 $base =~ s!/+\z!!;
                 $uri = $cgi->request_uri;
         }
+        my $qs = '';
+        if ($uri =~ s/(\?.+)\z//) {
+                $qs = $1;
+        }
         if ($uri !~ s!/+\z!!) {
                 warn "W: buggy redirect? base=$base request_uri=$uri\n";
         }
-        my $url = $base . $uri;
+        my $url = $base . $uri . $qs;
         [ 301,
           [ Location => $url, 'Content-Type' => 'text/plain' ],
           [ "Redirecting to $url\n" ] ]