Actions
Patch #18047
closedMailHandler: Don't use String#respond_to?(:force_encoding) to differentiate between Ruby 1.8 and Ruby 1.9
Start date:
Due date:
% Done:
0%
Estimated time:
Description
In source:/trunk/app/models/mail_handler.rb@13413#L424, whether String#force_encoding
is defined is used to make a decision about Mail::RubyVer
, which defines pick_encoding
on everything but Ruby 1.8.
This is dangerous as it couples knowledge about Ruby 1.8 (String#force_encoding
is not defined) with knowledge about the Mail
gem internals (Mail::RubyVer.pick_encoding
is not defined on 1.8), there is no guarantee that this will always be the case though.
The attached patch checks whether Mail::RubyVer.pick_encoding
is defined before using it instead of using the indirection through whether String#force_encoding
is defined or not.
Files
Related issues
Updated by Toshi MARUYAMA about 10 years ago
- Related to Patch #15785: Support more character encodings in incoming emails added
Updated by Toshi MARUYAMA about 10 years ago
- Category set to Email receiving
- Target version set to 2.6.0
Updated by Toshi MARUYAMA about 10 years ago
- Subject changed from Don't use String#respond_to?(:force_encoding) to differentiate between Ruby 1.8 and Ruby 1.9 to MailHandler: Don't use String#respond_to?(:force_encoding) to differentiate between Ruby 1.8 and Ruby 1.9
Updated by Toshi MARUYAMA about 10 years ago
- Status changed from New to Closed
Actions