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-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,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 0483A2141D for ; Fri, 1 Feb 2019 08:55:09 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/4] view: fix broken hunk header hrefs in Atom feeds Date: Fri, 1 Feb 2019 08:55:08 +0000 Message-Id: <20190201085508.24003-5-e@80x24.org> In-Reply-To: <20190201085508.24003-1-e@80x24.org> References: <20190201085508.24003-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We use absolute URLs in the Atom feeds (to ease syndication/mirroring), so hunk headers need to point to the solver URLs. --- lib/PublicInbox/View.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 8c81253..782e668 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -573,13 +573,18 @@ sub add_text_body { $ctx->{-diff} = $diff = []; my $spfx; if ($ibx->{-repo_objs}) { - my $n_slash = $upfx =~ tr!/!/!; - if ($n_slash == 0) { - $spfx = '../'; - } elsif ($n_slash == 1) { - $spfx = ''; - } else { # nslash == 2 - $spfx = '../../'; + if (index($upfx, '//') >= 0) { # absolute URL (Atom feeds) + $spfx = $upfx; + $spfx =~ s!/([^/]*)/\z!/!; + } else { + my $n_slash = $upfx =~ tr!/!/!; + if ($n_slash == 0) { + $spfx = '../'; + } elsif ($n_slash == 1) { + $spfx = ''; + } else { # nslash == 2 + $spfx = '../../'; + } } } $ctx->{-spfx} = $spfx; -- EW