diff options
-rw-r--r-- | actionmailer/CHANGELOG | 2 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail/quoting.rb | 5 | ||||
-rwxr-xr-x | actionmailer/test/mail_service_test.rb | 6 |
3 files changed, 12 insertions, 1 deletions
diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG index 9f0bfd4a68..59a4e40ed2 100644 --- a/actionmailer/CHANGELOG +++ b/actionmailer/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Silently ignore Errno::EINVAL errors when converting text. + * Don't cause an error when parsing an encoded attachment name #1340 [lon@speedymac.com] * Nested multipart message parts are correctly processed in TMail::Mail#body diff --git a/actionmailer/lib/action_mailer/vendor/tmail/quoting.rb b/actionmailer/lib/action_mailer/vendor/tmail/quoting.rb index 4420f2ea6b..b593efafcd 100644 --- a/actionmailer/lib/action_mailer/vendor/tmail/quoting.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail/quoting.rb @@ -79,10 +79,13 @@ module TMail def convert_to(text, to, from) return text unless to && from text ? Iconv.iconv(to, from, text).first : "" - rescue Iconv::IllegalSequence + rescue Iconv::IllegalSequence, Errno::EINVAL # the 'from' parameter specifies a charset other than what the text # actually is...not much we can do in this case but just return the # unconverted text. + # + # Ditto if either parameter represents an unknown charset, like + # X-UNKNOWN. text end rescue LoadError diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 9ed2cd2293..d9f6935674 100755 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -515,5 +515,11 @@ EOF fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email9") assert_raise(TMail::SyntaxError) { TMail::Mail.parse(fixture) } end + + def test_decode_message_with_unknown_charset + fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email10") + mail = TMail::Mail.parse(fixture) + assert_nothing_raised { mail.body } + end end |