From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B7D8E1F4B4 for ; Tue, 22 Dec 2020 05:04:16 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] wwwstream: show relative coderepo URLs correctly Date: Tue, 22 Dec 2020 05:04:16 +0000 Message-Id: <20201222050416.22592-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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); }