my ($class, $ctx, $cb, $fn) = @_;
my $body = $class->new($ctx, $cb);
# http://www.iana.org/assignments/media-types/application/gzip
- my @h = qw(Content-Type application/gzip);
- if (defined $fn && $fn ne '') {
- $fn = to_filename($fn);
- push @h, 'Content-Disposition', "inline; filename=$fn.mbox.gz";
- }
- [ 200, \@h, $body ];
+ $fn = defined($fn) && $fn ne '' ? to_filename($fn) : 'no-subject';
+ my $h = [ qw(Content-Type application/gzip),
+ 'Content-Disposition', "inline; filename=$fn.mbox.gz" ];
+ [ 200, $h, $body ];
}
sub gzip_fail ($$) {
'subject-less message linked from "/$INBOX/?q=..."');
like($html, qr/\bhref="blank-subject[^>]+>\(no subject\)</,
'blank subject message linked from "/$INBOX/?q=..."');
+ $res = $cb->(GET('/test/no-subject-at-all@example.com/raw'));
+ like($res->header('Content-Disposition'),
+ qr/filename=no-subject\.txt/);
+ $res = $cb->(GET('/test/no-subject-at-all@example.com/t.mbox.gz'));
+ like($res->header('Content-Disposition'),
+ qr/filename=no-subject\.mbox\.gz/);
});
done_testing();