- my $path = mid2path(mid_clean($mime->header('Message-ID')));
- $mime = eval { Email::MIME->new($git->cat_file("HEAD:$path")) };
- if ($mime) {
- if ($state->{anchor_idx} == 0) {
- thread_html_head($cb, $mime);
+ $mime = eval {
+ my $path = mid2path(mid_clean($mime->header('Message-ID')));
+ Email::MIME->new($git->cat_file('HEAD:'.$path));
+ } or return;
+
+ if ($state->{anchor_idx} == 0) {
+ thread_html_head($cb, $mime, $state);
+ }
+
+ if (my $ghost = delete $state->{ghost}) {
+ # n.b. ghost messages may only be parents, not children
+ foreach my $g (@$ghost) {
+ my $mid = PublicInbox::Hval->new_msgid($g->[0]);
+ my $pfx = INDENT x $g->[1];
+ my $href = $mid->as_href;
+ my $html = $mid->as_html;
+ $$cb->write("<table><tr><td>$pfx</td><td>" .
+ PRE_WRAP .
+ '[parent not found: <' .
+ qq{<a\nhref="../../$href/">}.
+ "$html</a>>]</pre></td></table>");