From 6b51c6e762de67636c90b678b4bb28f970379b3c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 22 Aug 2015 11:41:23 +0000 Subject: mbox: support uncompressed mbox Some folks may want to view the mbox inline as a string of raw text, when guessing URLs. Let them do this... --- lib/PublicInbox/WWW.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/PublicInbox/WWW.pm') diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 30a7a436..33c71101 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -53,9 +53,10 @@ sub run { } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)\.html\z!o) { invalid_list_mid(\%ctx, $1, $2) || get_thread(\%ctx, $cgi); - } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)\.mbox\.gz!o) { + } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)\.mbox(\.gz)?\z!o) { my $sfx = $3; - invalid_list_mid(\%ctx, $1, $2) || get_thread_mbox(\%ctx, $cgi); + invalid_list_mid(\%ctx, $1, $2) || + get_thread_mbox(\%ctx, $cgi, $sfx); } elsif ($path_info =~ m!$LISTNAME_RE/f/\S+\.txt\z!o) { invalid_list_mid(\%ctx, $1, $2) || @@ -331,15 +332,16 @@ sub msg_pfx { "../f/$href.html"; } -# /$LISTNAME/t/$MESSAGE_ID.mbox.gz -> search results as gzipped mbox +# /$LISTNAME/t/$MESSAGE_ID.mbox -> thread as mbox +# /$LISTNAME/t/$MESSAGE_ID.mbox.gz -> thread as gzipped mbox # note: I'm not a big fan of other compression formats since they're # significantly more expensive on CPU than gzip and less-widely available, # especially on older systems. Stick to zlib since that's what git uses. sub get_thread_mbox { - my ($ctx, $cgi) = @_; + my ($ctx, $cgi, $sfx) = @_; my $srch = searcher($ctx) or return need_search($ctx); require PublicInbox::Mbox; - PublicInbox::Mbox::thread_mbox($ctx, $srch); + PublicInbox::Mbox::thread_mbox($ctx, $srch, $sfx); } 1; -- cgit v1.2.3-24-ge0c7