about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2018-12-30 12:41:25 +0000
committerEric Wong <e@80x24.org>2018-12-30 20:15:06 +0000
commit7d82a8bc04ce2e686371abc6b438ab121b9fa7d0 (patch)
tree137fd61f2f12c0f781b670ef25bf65efbe60ab1b /t
parentc3a8ba378c7d3548a5d3ede110b90f8aa8e2473e (diff)
downloadpublic-inbox-7d82a8bc04ce2e686371abc6b438ab121b9fa7d0.tar.gz
I've found two examples on https://lore.kernel.org/lkml/
where the messages declared themselves to be "multipart/mixed"
but were actually plain text:

	<87llgalspt.fsf@free.fr>
	<200308111450.h7BEoOu20077@mail.osdl.org>

With the mboxrd downloaded, mutt is able to view them without
difficulty.

Note: this change would require reindexing of Xapian to pick up
the changes.  But it's only two ancient messages, the first was
resent by the original sender and the second is too old to be
relevant.
Diffstat (limited to 't')
-rw-r--r--t/psgi_multipart_not.t65
1 files changed, 65 insertions, 0 deletions
diff --git a/t/psgi_multipart_not.t b/t/psgi_multipart_not.t
new file mode 100644
index 00000000..4c9fa57a
--- /dev/null
+++ b/t/psgi_multipart_not.t
@@ -0,0 +1,65 @@
+# Copyright (C) 2018 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+use strict;
+use warnings;
+use Test::More;
+use File::Temp qw/tempdir/;
+use Email::MIME;
+use PublicInbox::Config;
+use PublicInbox::WWW;
+my @mods = qw(DBD::SQLite Search::Xapian HTTP::Request::Common
+              Plack::Test URI::Escape Plack::Builder Plack::Test);
+foreach my $mod (@mods) {
+        eval "require $mod";
+        plan skip_all => "$mod missing for psgi_multipart_not.t" if $@;
+}
+use_ok($_) for @mods;
+use_ok 'PublicInbox::V2Writable';
+my $repo = tempdir('pi-psgi-multipart-not.XXXXXX', TMPDIR => 1, CLEANUP => 1);
+my $ibx = PublicInbox::Inbox->new({
+        mainrepo => $repo,
+        name => 'multipart-not',
+        version => 2,
+        -primary_address => 'test@example.com',
+});
+my $im = PublicInbox::V2Writable->new($ibx, 1);
+$im->{parallel} = 0;
+
+my $mime = PublicInbox::MIME->new(<<'EOF');
+Message-Id: <200308111450.h7BEoOu20077@mail.osdl.org>
+To: linux-kernel@vger.kernel.org
+Subject: [OSDL] linux-2.6.0-test3 reaim results
+Mime-Version: 1.0
+Content-Type: multipart/mixed ;
+        boundary="==_Exmh_120757360"
+Date: Mon, 11 Aug 2003 07:50:24 -0700
+From: exmh user <x@example.com>
+
+Freed^Wmultipart ain't what it used to be
+EOF
+
+ok($im->add($mime), 'added broken multipart message');
+$im->done;
+
+my $cfgpfx = "publicinbox.v2test";
+my $cfg = {
+        "$cfgpfx.address" => $ibx->{-primary_address},
+        "$cfgpfx.mainrepo" => $repo,
+};
+my $config = PublicInbox::Config->new($cfg);
+my $www = PublicInbox::WWW->new($config);
+
+my ($res, $raw);
+test_psgi(sub { $www->call(@_) }, sub {
+        my ($cb) = @_;
+        for my $u ('/v2test/?q=%22ain\'t what it used to be%22&x=t',
+                   '/v2test/new.atom', '/v2test/new.html') {
+                $res = $cb->(GET($u));
+                $raw = $res->content;
+                ok(index($raw, 'Freed^Wmultipart') >= 0, $u);
+                ok(index($raw, 'Warning: decoded text') >= 0, $u.' warns');
+        }
+});
+
+done_testing();
+1;