プロジェクト

全般

プロフィール

Vote #79775

完了

Adding an issue note via email fails due to NoMethodError

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

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

0%

予定工数:
category_id:
29
version_id:
145
issue_org_id:
30455
author_id:
332
assigned_to_id:
1
comments:
4
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
99
ステータス-->[Closed]

説明

After upgrading my production Redmine to 4.0.0, I encountered a critical problem that I cannot add issue notes by replying emails.

On investigation, it turned out that NoMethodError that is raised at source:tags/4.0.0/app/models/mail_handler.rb#L240 causes the problem.


     # ignore CLI-supplied defaults for new issues
     handler_options[:issue].clear

The code expects that the class of @handler_options[:issue]@ is Hash, however, it is actually ActionController::Parameters. Since the class does not have a "clear" method, the code raises exception and Redmine fails to add the email to the issue note.

The error cannot be detected by running the unit test because the class of @handler_options[:issue]@ is not ActionController::Parameters but Hash in a test environment.

The following is a workaround for this issue.


Index: app/models/mail_handler.rb
===================================================================
--- app/models/mail_handler.rb  (revision 17805)
+++ app/models/mail_handler.rb  (working copy)
@@ -237,7 +237,7 @@
     end

     # ignore CLI-supplied defaults for new issues
-    handler_options[:issue].clear
+    handler_options[:issue] = {}

     journal = issue.init_journal(user)
     if from_journal && from_journal.private_notes?

journals

This is a serious issue that must be fixed asap.
--------------------------------------------------------------------------------
Attaching a patch with a test.
--------------------------------------------------------------------------------
Slightly improved the test.
--------------------------------------------------------------------------------
Committed, thanks.
--------------------------------------------------------------------------------

Admin Redmine さんが4年以上前に更新

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

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

いいね!0
いいね!0