/$LISTNAME/f/$MESSAGE_ID -> 301 to .html version
/$LISTNAME/f/$MESSAGE_ID.txt -> 301 to m/$MESSAGE_ID.txt
+FIXME: we must refactor/cleanup/add tests for most of our CGI before
+adding more endpoints and features.
+
Maybe TODO (these might be expensive)
-------------------------------------
/$LISTNAME/t/$MESSAGE_ID.html -> HTML content of thread
my $midurl = $feed_opts->{midurl} || 'http://example.com/m/';
my $fullurl = $feed_opts->{fullurl} || 'http://example.com/f/';
- my $content = PublicInbox::View->as_feed_entry($mime, $fullurl);
- defined($content) or return 0;
-
my $mid = utf8_header($mime, "Message-ID") or return 0;
- $mid =~ s/\A<//; $mid =~ s/>\z//;
+ # FIXME: refactor
+ my (undef, $href) = PublicInbox::View::trim_message_id($mid);
+
+ my $content = PublicInbox::View->as_feed_entry($mime,
+ "$fullurl$href.html");
+ defined($content) or return 0;
my $subject = utf8_header($mime, "Subject") || "";
length($subject) or return 0;
my $email = $from[0]->address;
defined $email or $email = "";
- my $url = $midurl . uri_escape($mid);
my $date = utf8_header($mime, "Date");
$date or return 0;
$date = feed_date($date) or return 0;
title => $subject,
updated => $date,
content => { type => "html", content => $content },
- link => $url,
+ link => $midurl . $href,
id => $add,
);
1;
my $mid = utf8_header($simple, "Message-ID");
$mid =~ s/\A<//;
$mid =~ s/>\z//;
- my $url = $args->[1] . uri_escape($mid);
+ my $url = $args->[1] . xs_html(uri_escape($mid));
my $from = utf8_header($simple, "From");
my @from = Email::Address->parse($from);
$from = $from[0]->name;
my $x = mid2blob($ctx);
return r404() unless $x;
- my $pfx = "../f/" . uri_escape($ctx->{mid}) . ".html";
require PublicInbox::View;
+ my $mid_href = PublicInbox::View::ascii_html(uri_escape($ctx->{mid}));
+ my $pfx = "../f/$mid_href.html";
require Email::MIME;
[ "200 OK", {'Content-Type' => 'text/html'},
PublicInbox::View->as_html(Email::MIME->new($$x), $pfx)];