Defect #30455

Adding an issue note via email fails due to NoMethodError

Added by Go MAEDA about 1 month ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Email receiving
Target version:4.0.1
Resolution:Fixed Affected version:4.0.0

Description

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?

30455-fix.diff Magnifier (1.22 KB) Go MAEDA, 2019-01-17 12:49

30455-fix-v2.diff Magnifier (1.28 KB) Go MAEDA, 2019-01-17 13:29

Associated revisions

Revision 17817
Added by Jean-Philippe Lang about 1 month ago

Adding an issue note via email fails due to NoMethodError (#30455).

Patch by Go MAEDA.

Revision 17818
Added by Jean-Philippe Lang about 1 month ago

Merged r17817 to 4.0-stable (#30455).

History

#1 Updated by Go MAEDA about 1 month ago

  • Target version set to 4.0.1

This is a serious issue that must be fixed asap.

#2 Updated by Go MAEDA about 1 month ago

Attaching a patch with a test.

#3 Updated by Go MAEDA about 1 month ago

Slightly improved the test.

#4 Updated by Jean-Philippe Lang about 1 month ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Committed, thanks.

Also available in: Atom PDF