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) .
'</pre></body></html>';
}
}
sub headers_to_html_header {
- my ($simple) = @_;
+ my ($simple, $full_pfx) = @_;
my $rv = "";
my @title;
if (defined $mid) {
my ($html, $href) = trim_message_id($mid);
$rv .= "Message-ID: <$html> ";
+ unless ($full_pfx) {
+ $href = "../m/$href";
+ }
$rv .= "(<a href=\"$href.txt\">original</a>)\n";
}
} 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);
$s = Email::MIME->new($s->as_string);
my $html = PublicInbox::View->as_html($s);
- # ghetto
- like($html, qr/<a href="hello%40/s, "MID link present");
+ # ghetto tests
+ like($html, qr!<a href="\.\./m/hello%40!s, "MID link present");
like($html, qr/hello world\b/, "body present");
like($html, qr/> keep this inline/, "short quoted text is inline");
like($html, qr/<a name=[^>]+>> Long and wordy/,
# short page
my $pfx = "http://example.com/test/f";
my $short = PublicInbox::View->as_html($s, $pfx);
+ like($short, qr!<a href="hello%40!s, "MID link present");
like($short, qr/\n> keep this inline/,
"short quoted text is inline");
like($short, qr/<a href="\Q$pfx\E#[^>]+>Long and wordy/,