lib/PublicInbox/MdirReader.pm | 1 + t/lei-import-maildir.t | 7 +++++++ diff --git a/lib/PublicInbox/MdirReader.pm b/lib/PublicInbox/MdirReader.pm index 44724af1524fc9b845a5f8f32286c56fc1a52e95..06806e80eafc02d636a9ce988076387c03a87112 100644 --- a/lib/PublicInbox/MdirReader.pm +++ b/lib/PublicInbox/MdirReader.pm @@ -57,6 +57,7 @@ $pfx = "$dir/cur/"; opendir my $dh, $pfx or return; while (defined(my $bn = readdir($dh))) { my $fl = maildir_basename_flags($bn) // next; + next if index($fl, 'T') >= 0; my $f = $pfx.$bn; my $eml = eml_from_path($f) or next; my @kw = sort(map { $c2kw{$_} // () } split(//, $fl)); diff --git a/t/lei-import-maildir.t b/t/lei-import-maildir.t index a37964912c20bf5944b5e7631c427dbdc8fe85be..bd89677aa1fd7bb899f0b8fa84c7f18e8bdbc943 100644 --- a/t/lei-import-maildir.t +++ b/t/lei-import-maildir.t @@ -29,5 +29,12 @@ $res = json_utf8->decode($lei_out); like($res->[0]->{'s'}, qr/use boolean/, 'got expected result'); is_deeply($res->[0]->{kw}, ['answered', 'seen'], 'keywords set'); is($res->[1], undef, 'only got one result'); + + symlink(abs_path('t/utf8.eml'), "$md/cur/u:2,ST") or + BAIL_OUT "symlink $md $!"; + lei_ok('import', "maildir:$md", \'import Maildir w/ trashed message'); + lei_ok(qw(q -d none m:testmessage@example.com)); + $res = json_utf8->decode($lei_out); + is_deeply($res, [ undef ], 'trashed message not imported'); }); done_testing;