]> Sergey Matveev's repositories - public-inbox.git/commitdiff
www: missing /$INBOX/$MSGID/raw returns 404
authorEric Wong <e@80x24.org>
Mon, 26 Apr 2021 08:02:16 +0000 (08:02 +0000)
committerEric Wong <e@80x24.org>
Mon, 26 Apr 2021 10:44:29 +0000 (10:44 +0000)
Don't attempt to return HTTP 300 via Extmsg on it,
since whoever uses /raw is likely piping it to some
other command.

lib/PublicInbox/WWW.pm
t/plack.t

index 456692a3a7391f0bf7f330d1bcb2190f5b2b43e2..8f4bfd0f36bf293b9df1b89a2d74229b195e4bf0 100644 (file)
@@ -272,7 +272,7 @@ sub get_index {
 sub get_mid_txt {
        my ($ctx) = @_;
        require PublicInbox::Mbox;
-       PublicInbox::Mbox::emit_raw($ctx) || r404($ctx);
+       PublicInbox::Mbox::emit_raw($ctx) || r(404);
 }
 
 # /$INBOX/$MESSAGE_ID/                   -> HTML content (short quotes)
index db72e6cc3bcae16eac8b432e5e5c084cdef02484..40ff2baa72739e72d80b2b2969327b899a7df37e 100644 (file)
--- a/t/plack.t
+++ b/t/plack.t
@@ -82,6 +82,8 @@ test_psgi($app, sub {
        $res = $cb->(GET('http://example.com/test/crlf@example.com/raw'));
        is($res->code, 200, 'retrieved CRLF raw');
        like($res->content, qr/\r/, 'CR preserved in raw message');
+       $res = $cb->(GET('http://example.com/test/bogus@example.com/raw'));
+       is($res->code, 404, 'missing /raw is 404');
 });
 
 # redirect with newsgroup