From b2492cc6ef642640c901ccca5ff96b9228cd10ec Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 3 Mar 2017 22:07:19 +0000 Subject: repobrowse: src/ endpoint requires a tip to be specified Implying a tip would make for ambiguous URLs and ruin caching, so try to get everybody to hit the same URL. This also simplifies some of our other code since the tip is always in the request. --- lib/PublicInbox/RepoBase.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/RepoBase.pm') diff --git a/lib/PublicInbox/RepoBase.pm b/lib/PublicInbox/RepoBase.pm index e600b1df..5d38579c 100644 --- a/lib/PublicInbox/RepoBase.pm +++ b/lib/PublicInbox/RepoBase.pm @@ -86,7 +86,7 @@ sub r { my $env = $req->{env}; my $base = PublicInbox::Repobrowse::base_url($env); my ($redir) = @extra; - if ($redir =~ m!\A\.\./!) { # relative redirect + if (index($redir, '/') != 0) { # relative redirect my @orig = split(m!/+!, $env->{PATH_INFO}); my @dest = split(m!/+!, $redir); @@ -98,7 +98,7 @@ sub r { $end = pop @dest if $dest[-1] =~ /\A[#\?]/; $redir = $base . join('/', @orig, @dest) . $end; } else { - $redir = $base . '/' . $redir; + $redir = $base . $redir; } push @h, qw(Content-Type text/plain Location), $redir; -- cgit v1.2.3-24-ge0c7