like($f->simple->as_string, qr/scrubbed/, "scrubbed message");
}
+{
+ my $s = Email::Simple->create(
+ header => [
+ From => 'a@example.com',
+ To => 'b@example.com',
+ 'Content-Type' => 'text/plain',
+ 'Mail-Followup-To' => 'c@example.com',
+ Subject => 'mfttest',
+ ],
+ body => "mft\n",
+ );
+
+ is('c@example.com', $s->header("Mail-Followup-To"),
+ "mft set correctly");
+ my $f = Email::Filter->new(data => $s->as_string);
+ is(1, PublicInbox::Filter->run($f->simple), "run succeeded for mft");
+ is(undef, $f->simple->header("Mail-Followup-To"), "mft stripped");
+}
+
+# multi-part with application/octet-stream
+{
+ my $os = 'application/octet-stream';
+ my $parts = [
+ Email::MIME->create(
+ attributes => { content_type => $os },
+ body => <<EOF
+#include <stdio.h>
+int main(void)
+{
+ printf("Hello world\\n");
+ return 0;
+}
+\f
+/* some folks like ^L */
+EOF
+ ),
+ Email::MIME->create(
+ attributes => {
+ filename => 'zero.data',
+ encoding => 'base64',
+ content_type => $os,
+ },
+ body => ("\0" x 4096),
+ )
+ ];
+ my $email = Email::MIME->create(
+ header_str => [ From => 'a@example.com', Subject => 'blah' ],
+ parts => $parts,
+ );
+ my $f = Email::Filter->new(data => $email->as_string);
+ is(1, PublicInbox::Filter->run($f->simple), "run was a success");
+ my $parsed = Email::MIME->new($f->simple->as_string);
+ is(scalar $parsed->parts, 1, "only one remaining part");
+ like($f->simple->header("X-Content-Filtered-By"),
+ qr/PublicInbox::Filter/, "XCFB header added");
+}
+
done_testing();