lib/PublicInbox/Feed.pm | 1 + lib/PublicInbox/View.pm | 20 ++------------------ lib/PublicInbox/WwwAtomStream.pm | 1 + diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index affe0fb6229ebf8b4fa5d54c604e75481b1d7e6a..de1e7dfeb584a5631acb8704d909b51ceedc2223 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -70,6 +70,7 @@ ["No messages, yet\n"] ]; } $ctx->{-html_tip} = '
';
$ctx->{-upfx} = '';
+ $ctx->{-spfx} = '' if $ctx->{ibx}->{coderepo};
$ctx->{-hr} = 1;
PublicInbox::WwwStream::aresponse($ctx, \&new_html_i);
}
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 0753c06ee4f81b4a4494ab05210b6bc60e71073a..01c086bf0676bb4904387f0de45aa619c687b3dc 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -80,6 +80,7 @@
# allow user to easily browse the range around this message if
# they have ->over
$ctx->{-t_max} = $smsg->{ts};
+ $ctx->{-spfx} = '../' if $ibx->{coderepo};
PublicInbox::WwwStream::aresponse($ctx, \&msg_page_i);
}
@@ -441,6 +442,7 @@ my $mid = $ctx->{mid};
my $ibx = $ctx->{ibx};
my ($nr, $msgs) = $ibx->over->get_thread($mid);
return missing_thread($ctx) if $nr == 0;
+ $ctx->{-spfx} = '../../' if $ibx->{coderepo};
# link $INBOX_DIR/description text to "index_topics" view around
# the newest message in this thread
@@ -584,24 +586,6 @@ # do attr => filename mappings for diffstats in git diffs:
$ctx->{-anchors} = {} if $s =~ /^diff --git /sm;
$diff = 1;
delete $ctx->{-long_path};
- my $spfx;
- # absolute URL (Atom feeds)
- if ($ibx->{coderepo}) {
- if (index($upfx, '//') >= 0) {
- $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;
};
# split off quoted and unquoted blocks:
diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm
index 33da32443c0f941cb01ce6de07a625b03d176097..83a8818e5fb1e517a085d3541df14a727882886d 100644
--- a/lib/PublicInbox/WwwAtomStream.pm
+++ b/lib/PublicInbox/WwwAtomStream.pm
@@ -16,6 +16,7 @@
sub new {
my ($class, $ctx, $cb) = @_;
$ctx->{feed_base_url} = $ctx->{ibx}->base_url($ctx->{env});
+ $ctx->{-spfx} = $ctx->{feed_base_url} if $ctx->{ibx}->{coderepo};
$ctx->{cb} = $cb || \&PublicInbox::GzipFilter::close;
$ctx->{emit_header} = 1;
bless $ctx, $class;