Subject: | Prepare filename in upload |
Date: | Wed, 26 Aug 2009 20:09:18 +0200 |
To: | bug-Catalyst-Plugin-Unicode [...] rt.cpan.org |
From: | Erik Gimbert <erik.gimbert [...] groupsquad.com> |
Filename in uploads wasn't decode by prepare_parameters.
To decode filename you can add the next method :
sub prepare_uploads {
my $c = shift;
$c->next::method(@_);
for my $value ( values %{ $c->request->{uploads} } ) {
if ( ref $value && ref $value !~
/^(?:ARRAY|Catalyst::Request::Upload)$/ ) {
next;
}
my $fn;
for ( ref($value) eq 'ARRAY' ? @{$value} : $value ) {
$fn = $_->filename;
utf8::decode($fn);
$_->filename($fn);
}
}
}
Erik