Subject: | multibyte_filename.t fails with Encode 2.55 |
After upgrading Encode from 2.54 to 2.55 I have experienced Mojolicious-Plugin-RenderFile-0.06 test failure which looks exactly like this:
http://www.cpantesters.org/cpan/report/01702cac-1836-11e3-b595-a19eb3fe1846
See enclosed patch.
--
Karel
Subject: | encode-patch.diff |
diff -ru Mojolicious-Plugin-RenderFile-0.06\lib\Mojolicious\Plugin\RenderFile.pm Mojolicious-Plugin-RenderFile-0.06.patched\lib\Mojolicious\Plugin\RenderFile.pm
--- Mojolicious-Plugin-RenderFile-0.06\lib\Mojolicious\Plugin\RenderFile.pm Sat Mar 23 18:13:20 2013
+++ Mojolicious-Plugin-RenderFile-0.06.patched\lib\Mojolicious\Plugin\RenderFile.pm Sun Sep 15 11:31:10 2013
@@ -15,8 +15,10 @@
$app->helper( 'render_file' => sub {
my $c = shift;
my %args = @_;
+ utf8::decode($args{filename}) if $args{filename} && !utf8::is_utf8($args{filename});
+ utf8::decode($args{filepath}) if $args{filepath} && !utf8::is_utf8($args{filepath});
- my $filename = decode_utf8($args{filename});
+ my $filename = $args{filename};
my $status = $args{status} || 200;
my $content_disposition = $args{content_disposition} || 'attachment';
@@ -27,7 +29,7 @@
# Create asset
my $asset;
- if ( my $filepath = decode_utf8($args{filepath}) ) {
+ if ( my $filepath = $args{filepath} ) {
unless ( -f $filepath && -r $filepath ) {
$c->app->log->error("Cannot read file [$filepath]. error [$!]");
return;