diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-12-06 09:04:26 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-12-06 09:04:26 +0000 |
commit | 74029c7c3994fa09374ea92be01138999a65af0a (patch) | |
tree | 33d19c85cdb4287fd7b1b61038bbd28ea173953a /lib/mail_handler/backends/mail_extensions.rb | |
parent | c029763353aa3b762e735bb7ed3523d11a53a032 (diff) |
Patch the Message initialize method so that it doesn't strip the initial input - trailing spaces can be meaningful.
Diffstat (limited to 'lib/mail_handler/backends/mail_extensions.rb')
-rw-r--r-- | lib/mail_handler/backends/mail_extensions.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/mail_handler/backends/mail_extensions.rb b/lib/mail_handler/backends/mail_extensions.rb index a3c70213c..d9106948d 100644 --- a/lib/mail_handler/backends/mail_extensions.rb +++ b/lib/mail_handler/backends/mail_extensions.rb @@ -5,5 +5,44 @@ module Mail attr_accessor :within_rfc822_attachment # for parts within a message attached as text (for getting subject mainly) attr_accessor :count_parts_count attr_accessor :count_first_uudecode_count + + # A patched version of the message initializer to work around a bug where stripping the original + # input removes meaningful spaces - e.g. in the case of uuencoded bodies. + def initialize(*args, &block) + @body = nil + @body_raw = nil + @separate_parts = false + @text_part = nil + @html_part = nil + @errors = nil + @header = nil + @charset = 'UTF-8' + @defaulted_charset = true + + @perform_deliveries = true + @raise_delivery_errors = true + + @delivery_handler = nil + + @delivery_method = Mail.delivery_method.dup + + @transport_encoding = Mail::Encodings.get_encoding('7bit') + + @mark_for_delete = false + + if args.flatten.first.respond_to?(:each_pair) + init_with_hash(args.flatten.first) + else + # The replacement of this commented out line is the change. + # init_with_string(args.flatten[0].to_s.strip) + init_with_string(args.flatten[0].to_s) + end + + if block_given? + instance_eval(&block) + end + + self + end end end
\ No newline at end of file |