Project

General

Profile

Actions

Defect #43255

open

mail_handler : may fail to invoke reception hooks if plugins monkey patch some methods (with patch)

Added by Vincent Caron 1 day ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Email receiving
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

I recently realized that my incoming emails were partially processed : reply to issues would be ignore.

It turns out that the plugin redmine_per_project_formatting I'm using monkey patch the `MailHandler::receive_issue_reply` (and an another) and this code has to be changed to check if a method is callable instead of only searching for it in the Redmine module :

```#diff
--- app/models/mail_handler.rb.orig 2025-03-11 00:30:03.000000000 0100
++ app/models/mail_handler.rb 2025-09-26 18:42:40.504660223 0200
@ -155,7 +155,7 @
if headers.detect {|h| h.to_s =~ MESSAGE_ID_RE}
klass, object_id = $1, $2.to_i
method_name = "receive_#{klass}_reply"
- if self.class.private_instance_methods.collect(&:to_s).include?(method_name)
if self.class.method_defined?(method_name)
send method_name, object_id
else # ignoring it
```

No data to display

Actions

Also available in: Atom PDF