From b3bc0d722aacdad5ac5e8ee7c32bda9c87d3052b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 20 Jan 2016 22:17:37 +0000 Subject: repobrowse: fix redirects with query string We need to preserve the query string to avoid breakage. --- lib/PublicInbox/Repobrowse.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/Repobrowse.pm') 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" ] ] -- cgit v1.2.3-24-ge0c7