X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FMbox.pm;h=97bec5e79a3b468b88faa0b2e8ac72bbf198552f;hb=a318e758129d616b3b801db82c4735c680a2fbe8;hp=d5beceaf65e18b650e147dfef5ed213e8f1a5270;hpb=1e5d704f1234ded472b800e42bedb5579780296e;p=public-inbox.git diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm index d5beceaf..97bec5e7 100644 --- a/lib/PublicInbox/Mbox.pm +++ b/lib/PublicInbox/Mbox.pm @@ -106,8 +106,11 @@ sub msg_hdr ($$;$) { 'List-Post', "{-primary_address}>", ); my $crlf = $header_obj->crlf; - my $buf = "From mboxrd\@z Thu Jan 1 00:00:00 1970\n" . - $header_obj->as_string; + my $buf = $header_obj->as_string; + # fixup old bug from import (pre-a0c07cba0e5d8b6a) + $buf =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s; + $buf = "From mboxrd\@z Thu Jan 1 00:00:00 1970" . $crlf . $buf; + for (my $i = 0; $i < @append; $i += 2) { my $k = $append[$i]; my $v = $append[$i + 1]; @@ -149,8 +152,7 @@ sub thread_cb { sub thread_mbox { my ($ctx, $over, $sfx) = @_; - eval { require PublicInbox::MboxGz }; - return need_gzip($ctx) if $@; + require PublicInbox::MboxGz; my $msgs = $ctx->{msgs} = $over->get_thread($ctx->{mid}, {}); return [404, [qw(Content-Type text/plain)], []] if !@$msgs; $ctx->{prev} = $msgs->[-1]; @@ -218,8 +220,7 @@ sub results_cb { sub mbox_all { my ($ctx, $query) = @_; - eval { require PublicInbox::MboxGz }; - return need_gzip($ctx) if $@; + require PublicInbox::MboxGz; return mbox_all_ids($ctx) if $query eq ''; my $qopts = $ctx->{qopts} = { mset => 2 }; my $srch = $ctx->{srch} = $ctx->{-inbox}->search or @@ -233,15 +234,4 @@ sub mbox_all { PublicInbox::MboxGz->response($ctx, \&results_cb, 'results-'.$query); } -sub need_gzip { - html_oneshot($_[0], 501, \<gzipped mbox not available - -The administrator needs to install the Compress::Raw::Zlib Perl module -to support gzipped mboxes. - -Return to index -EOF -} - 1;