about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-02-01 01:47:31 +0000
committerEric Wong <e@80x24.org>2019-02-01 01:49:39 +0000
commit1e03323d76eb6c029ab6749fe783f25d5d109e1f (patch)
treec835f17c50f8dbd4818433bc1b6e4bac336a1831 /lib/PublicInbox/View.pm
parent13d83f3b0c4a80c99c3c14fc81206e72cda8583a (diff)
downloadpublic-inbox-1e03323d76eb6c029ab6749fe783f25d5d109e1f.tar.gz
We use absolute URLs in the Atom feeds (to ease
syndication/mirroring), so hunk headers need to point to the
solver URLs.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r--lib/PublicInbox/View.pm19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 8c812536..782e6686 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;