[Jifty-commit] r4286 - jifty/trunk/lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sun Oct 21 16:25:28 EDT 2007
Author: audreyt
Date: Sun Oct 21 16:25:26 2007
New Revision: 4286
Modified:
jifty/trunk/lib/Jifty/I18N.pm
Log:
* Jifty::I18N::promote_encoding:
Multi-part form data have no notion of charsets, so we return the string
verbatim here, to avoid the "Unquoted / not allowed in Content-Type"
warnings when the Base64-encoded MIME boundary string contains "/".
Prompted by this Content-Type header found in real world:
multipart/form-data; boundary=----WebKitFormBoundaryRqXyEnBQ/5VSsexe
which triggered this error:
-- 2007/10/22 04:19:30 WARN> Carp.pm:46 Carp::carp
Unquoted / not allowed in Content-Type! at /usr/local/lib/perl5/site_perl/5.9.5/Jifty/I18N.pm line 226
-- 2007/10/22 04:19:30 WARN> Carp.pm:46 Carp::carp
Illegal Content-Type parameter /5VSsexe at /usr/local/lib/perl5/site_perl/5.9.5/Jifty/I18N.pm line 226
Modified: jifty/trunk/lib/Jifty/I18N.pm
==============================================================================
--- jifty/trunk/lib/Jifty/I18N.pm (original)
+++ jifty/trunk/lib/Jifty/I18N.pm Sun Oct 21 16:25:26 2007
@@ -221,9 +221,17 @@
my $class = shift;
my $string = shift;
my $content_type = shift;
+ my $charset;
- $content_type = Email::MIME::ContentType::parse_content_type($content_type) if $content_type;
- my $charset = $content_type->{attributes}->{charset} if $content_type;
+ if ($content_type) {
+ # Multi-part form data have no notion of charsets, so we return the string
+ # verbatim here, to avoid the "Unquoted / not allowed in Content-Type"
+ # warnings when the Base64-encoded MIME boundary string contains "/".
+ return $string if $content_type =~ /^multipart\b/;
+
+ $content_type = Email::MIME::ContentType::parse_content_type($content_type);
+ $charset = $content_type->{attributes}->{charset};
+ }
# XXX TODO Is this the right thing? Maybe we should just return
# the string as-is.
More information about the Jifty-commit
mailing list