Convert to string before calling encoding on it. #430

Merged
merged 1 commit into from Nov 17, 2012

Conversation

Projects
None yet
3 participants
Contributor

brupm commented Aug 30, 2012

Addresses issue #299 where value would be converted to an array and calling enconding on Array causes it to blow up as such:

vendor/bundle/ruby/1.9.1/gems/mail-2.3.3/lib/mail/fields/unstructured_field.rb:75:in `do_decode'
vendor/bundle/ruby/1.9.1/gems/mail-2.3.3/lib/mail/fields/unstructured_field.rb:56:in `decoded'
vendor/bundle/ruby/1.9.1/gems/mail-2.3.3/lib/mail/fields/unstructured_field.rb:60:in `default'
vendor/bundle/ruby/1.9.1/gems/mail-2.3.3/lib/mail/field.rb:123:in `method_missing'
vendor/bundle/ruby/1.9.1/gems/mail-2.3.3/lib/mail/message.rb:1107:in `default'
vendor/bundle/ruby/1.9.1/gems/mail-2.3.3/lib/mail/message.rb:517:in `cc'
vendor/bundle/ruby/1.9.1/gems/actionmailer-3.1.8/lib/action_mailer/base.rb:449:in `set_payload_for_mail'
vendor/bundle/ruby/1.9.1/gems/actionmailer-3.1.8/lib/action_mailer/base.rb:431:in `block in deliver_mail'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.8/lib/active_support/notifications.rb:53:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.8/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.8/lib/active_support/notifications.rb:53:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionmailer-3.1.8/lib/action_mailer/base.rb:430:in `deliver_mail'
vendor/bundle/ruby/1.9.1/gems/mail-2.3.3/lib/mail/message.rb:230:in `deliver'
app/jobs/colleague_invitation_job.rb:46:in `notify_via_email'
app/jobs/colleague_invitation_job.rb:23:in `perform'

There may be a better solution to this problem which I am not aware of at the time of this writing. This patch does not break currently functionality when value is a string and if it is an array it simply calls to_s on it.

This pull request fails (merged 9bc7616 into f19ffd4).

Owner

mikel commented Nov 17, 2012

Thanks.

@mikel mikel merged commit 9bc7616 into mikel:master Nov 17, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment