プロジェクト

全般

プロフィール

Vote #75634

完了

MailHandler: Don't use String#respond_to?(:force_encoding) to differentiate between Ruby 1.8 and Ruby 1.9

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Email receiving_29
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
29
version_id:
81
issue_org_id:
18047
author_id:
3866
assigned_to_id:
0
comments:
5
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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.


journals

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed in trunk r13432, thanks.

Rails 4 dropped Ruby 1.8 support.
So, Rails 4 branch r13255 removed this check.
--------------------------------------------------------------------------------
Great, thanks!
--------------------------------------------------------------------------------


related_issues

relates,Closed,15785,Support more character encodings in incoming emails

Admin Redmine さんが約4年前に更新

  • カテゴリEmail receiving_29 にセット
  • 対象バージョン2.6.0_81 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0