From 37526779e4c544b134af74f43d6c26569cb8e466 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 22 Dec 2020 05:04:16 +0000 Subject: [PATCH] wwwstream: show relative coderepo URLs correctly Trying to link "foo.git" relative to the current URL usually does not provide correct results, so prefix it by going into the parent directory if an absolute (or protocol-relative) URL is not supplied. --- lib/PublicInbox/WwwStream.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm index 9ba8fa11..958251a3 100644 --- a/lib/PublicInbox/WwwStream.pm +++ b/lib/PublicInbox/WwwStream.pm @@ -81,13 +81,17 @@ sub coderepos ($) { my ($ctx) = @_; my $cr = $ctx->{ibx}->{coderepo} // return (); my $cfg = $ctx->{www}->{pi_cfg}; + my $upfx = ($ctx->{-upfx} // ''). '../'; my @ret; for my $cr_name (@$cr) { my $urls = $cfg->{"coderepo.$cr_name.cgiturl"} // next; $ret[0] //= <{env}, $u)); $ret[0] .= qq(\n\t$u); } -- 2.44.0