From 81ea7f0100f016ad8c66605b49230e876a1eb82d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 26 Aug 2022 10:15:45 +0000 Subject: www: fix unindexed v1 inboxes w/ public-inbox-httpd Unindexed v1 inboxes were leaving $smsg objects unpopulated when using public-inbox-httpd (but not generic PSGI servers) and causing missing HTML content and uninitialized value warnings. Our existing tests for unindexed v1 inboxes only assumed generic PSGI servers and synchronous blob retrieval. Due to changes several years ago to make git blob retrieval async for slow storage using public-inbox-httpd, our tests were insufficient to detect this regression. So ensure $smsg->populate runs in a few places and rewrite t/plack.t to test against both generic PSGI and -httpd implementations. Fortunately, unindexed v1 inboxes are uncommon, and this bug was only (finally) discovered while developing other features. For ensuring we can test (and not blindly follow) redirects with -httpd, we now provide our own LWP::UserAgent (used internally by Plack::Test::ExternalServer) with redirect following disabled to P:T:ES::test_psgi. --- lib/PublicInbox/Feed.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/Feed.pm') diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index ee579f6d..e0810420 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -51,7 +51,10 @@ sub new_html_i { my ($ctx, $eml) = @_; $ctx->zmore($ctx->html_top) if exists $ctx->{-html_tip}; - $eml and return PublicInbox::View::eml_entry($ctx, $eml); + if ($eml) { + $ctx->{smsg}->populate($eml) if !$ctx->{ibx}->{over}; + return PublicInbox::View::eml_entry($ctx, $eml); + } my $smsg = shift @{$ctx->{msgs}} or $ctx->zmore(PublicInbox::View::pagination_footer( $ctx, './new.html')); -- cgit v1.2.3-24-ge0c7