X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FWwwAttach.pm;h=c17394afe8709b61caae9315f549d53c84ad758d;hb=5c8909925072804901e9c3b45bbf25446d379e7b;hp=0fe63e4232510a4facb9d2fe724c3fbd23af1bc3;hpb=8862c33ae93eea1af6246cd3c7a81e0a122186bf;p=public-inbox.git
diff --git a/lib/PublicInbox/WwwAttach.pm b/lib/PublicInbox/WwwAttach.pm
index 0fe63e42..c17394af 100644
--- a/lib/PublicInbox/WwwAttach.pm
+++ b/lib/PublicInbox/WwwAttach.pm
@@ -1,12 +1,11 @@
-# Copyright (C) 2016-2020 all contributors
+# Copyright (C) 2016-2021 all contributors
# License: AGPL-3.0+
# 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 ($) {
@@ -31,9 +30,7 @@ sub get_attach_i { # ->each_part callback
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};
@@ -53,7 +50,7 @@ sub get_attach_i { # ->each_part callback
$part = "Deep-linking prevented\n";
}
}
- push @{$res->[1]}, 'Content-Length', bytes::length($part);
+ push @{$res->[1]}, 'Content-Length', length($part);
$res->[2]->[0] = $part;
}