about summary refs log tree commit homepage
path: root/lib/PublicInbox/RepobrowseBase.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-12-22 04:38:13 +0000
committerEric Wong <e@80x24.org>2016-12-22 04:38:13 +0000
commit96ee5f0f64972f0ce3143538437d4de1febe3c51 (patch)
tree8035541c7ddeee835be3c81dc5d30b2614fa67b1 /lib/PublicInbox/RepobrowseBase.pm
parent00abc9a8c4582d8635c989fdf4010ff30cb92d4d (diff)
downloadpublic-inbox-96ee5f0f64972f0ce3143538437d4de1febe3c51.tar.gz
This does not make installation easier, but lightens runtime a
bit.  Plack::Request is unnecessary bloat and indirection which
does things behind our back.  $env has all the stuff we need.
Diffstat (limited to 'lib/PublicInbox/RepobrowseBase.pm')
-rw-r--r--lib/PublicInbox/RepobrowseBase.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/RepobrowseBase.pm b/lib/PublicInbox/RepobrowseBase.pm
index 33647fca..caec5ced 100644
--- a/lib/PublicInbox/RepobrowseBase.pm
+++ b/lib/PublicInbox/RepobrowseBase.pm
@@ -84,12 +84,11 @@ sub r {
         if ($status == 301 || $status == 302) {
                 # The goal is to be able to make redirects like we make
                 # <a href=> tags with '../'
-                my $cgi = $req->{cgi};
-                my $base = $cgi->base;
+                my $env = $req->{env};
+                my $base = PublicInbox::Repobrowse::base_url($env);
                 my ($redir) = @extra;
                 if ($redir =~ m!\A\.\./!) { # relative redirect
-                        my @orig = split(m!/+!, $cgi->path_info, -1);
-                        shift @orig; # drop leading '/'
+                        my @orig = split(m!/+!, $env->{PATH_INFO});
                         my @dest = split(m!/+!, $redir);
 
                         while ($dest[0] eq '..') {