lib/PublicInbox/View.pm | 7 +++++-- public-inbox.cgi | 2 +- t/view.t | 5 +++-- diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 5b24706c1ecd1d7003f5d13c5601688387cd2128..355d346adbbe54a1adb506f8ba7936b011ced436 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -19,7 +19,7 @@ # public functions: sub as_html { my ($class, $mime, $full_pfx) = @_; - headers_to_html_header($mime) . + headers_to_html_header($mime, $full_pfx) . multipart_text_as_html($mime, $full_pfx) . ''; } @@ -150,7 +150,7 @@ $enc_ascii->encode(escapeHTML($_[0]), Encode::HTMLCREF); } sub headers_to_html_header { - my ($simple) = @_; + my ($simple, $full_pfx) = @_; my $rv = ""; my @title; @@ -180,6 +180,9 @@ my $mid = $simple->header('Message-ID'); if (defined $mid) { my ($html, $href) = trim_message_id($mid); $rv .= "Message-ID: <$html> "; + unless ($full_pfx) { + $href = "../m/$href"; + } $rv .= "(original)\n"; } diff --git a/public-inbox.cgi b/public-inbox.cgi index b9b484be38b5eb584892fcdb3e3670f4b38e7cb0..fc48f2f4416a42c7345ee5c2e4db0cd9f51b57bb 100755 --- a/public-inbox.cgi +++ b/public-inbox.cgi @@ -78,7 +78,7 @@ # full-message page } elsif ($path_info =~ m!$LISTNAME_RE/f/(\S+)\.html\z!o) { invalid_list_mid(\%ctx, $1, $2) || get_full_html(\%ctx, $cgi); - # convenience redirect + # convenience redirects, order matters } elsif ($path_info =~ m!$LISTNAME_RE/(?:m|f)/(\S+)\z!o) { invalid_list_mid(\%ctx, $1, $2) || redirect_mid(\%ctx, $cgi); diff --git a/t/view.t b/t/view.t index 067f9890cc271abc0d1e7195b5d0e823ce677f6d..87f8eeeeea88380bd3b2239af232af83927c9503 100644 --- a/t/view.t +++ b/t/view.t @@ -36,8 +36,8 @@ ); $s = Email::MIME->new($s->as_string); my $html = PublicInbox::View->as_html($s); - # ghetto - like($html, qr/]+>> Long and wordy/, @@ -46,6 +46,7 @@ # short page my $pfx = "http://example.com/test/f"; my $short = PublicInbox::View->as_html($s, $pfx); + like($short, qr!