Subject: | MojoX::MIME::Types: Can't call method "extensions" on an undefined value |
I get this error wjhen using MojoX::MIME::Types with Chrome, because it could not detect type for "image/apng"
Can't call method "extensions" on an undefined value at /perls/perl-5.24.1/lib/site_perl/5.24.1/MojoX/MIME/Types.pm line 41.
MIME::Types version 2.13
Possible fix:
--- MIME-Types-2.13/lib/MojoX/MIME/Types.pm 2016-03-07 17:48:38.000000000 +0300
+++ MIME-Types-2.13-my/lib/MojoX/MIME/Types.pm 2017-10-16 15:15:42.371613158 +0300
@@ -38,7 +38,9 @@
sub detect($$;$)
{ my ($self, $accept, $prio) = @_;
my $mt = $self->mimeTypes;
- my @ext = map $mt->type($_)->extensions,
+ my @ext = map $_->extensions,
+ grep defined($_),
+ map $mt->type($_),
grep !/\*/, $mt->httpAccept($accept);
\@ext;
}
Subject: | fix.patch |
diff -Naur MIME-Types-2.13/lib/MojoX/MIME/Types.pm MIME-Types-2.13-my/lib/MojoX/MIME/Types.pm
--- MIME-Types-2.13/lib/MojoX/MIME/Types.pm 2016-03-07 17:48:38.000000000 +0300
+++ MIME-Types-2.13-my/lib/MojoX/MIME/Types.pm 2017-10-16 15:15:42.371613158 +0300
@@ -38,7 +38,9 @@
sub detect($$;$)
{ my ($self, $accept, $prio) = @_;
my $mt = $self->mimeTypes;
- my @ext = map $mt->type($_)->extensions,
+ my @ext = map $_->extensions,
+ grep defined($_),
+ map $mt->type($_),
grep !/\*/, $mt->httpAccept($accept);
\@ext;
}