-# Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# For retrieving attachments from messages in the WWW interface
package PublicInbox::WwwAttach; # internal package
use strict;
+use v5.10.1;
use parent qw(PublicInbox::GzipFilter);
-use bytes (); # only for bytes::length
-use PublicInbox::EmlContentFoo qw(parse_content_type);
use PublicInbox::Eml;
sub referer_match ($) {
return if $idx ne $ctx->{idx}; # [0-9]+(?:\.[0-9]+)+
my $res = $ctx->{res};
$res->[0] = 200;
- my $ct = $part->content_type;
- $ct = parse_content_type($ct) if $ct;
-
+ my $ct = $part->ct;
if ($ct && (($ct->{type} || '') eq 'text')) {
# display all text as text/plain:
my $cset = $ct->{attributes}->{charset};
$part = "Deep-linking prevented\n";
}
}
- push @{$res->[1]}, 'Content-Length', bytes::length($part);
+ push @{$res->[1]}, 'Content-Length', length($part);
$res->[2]->[0] = $part;
}