]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/MboxGz.pm
mboxgz: ensure gzipped mboxes always have filenames
[public-inbox.git] / lib / PublicInbox / MboxGz.pm
index 08e3c8464c4fb800fc075cd145d92ec16820a39e..30074e4dc2a73c7b50e28a9253d6fc53d125f9a6 100644 (file)
@@ -21,12 +21,10 @@ sub response {
        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 ($$) {