Project

General

Profile

Actions

Defect #38697

closed

Exception during thumbnail macro to image tag conversion in emails

Added by Yasu Saku over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Text formatting
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

Example of the error message displayed in the email:

Error executing the thumbnail macro (undefined method `controller_name' for #<Mailer:0x0001d21f88db58> Did you mean? controller_path)

This started happening after Issue #37379 was addressed.
And, I have created a patch, please check it out.
Best regards.


Files

fix.patch (1.54 KB) fix.patch Yasu Saku, 2023-06-11 15:32
add-test.patch (800 Bytes) add-test.patch Mizuki ISHIKAWA, 2023-08-29 10:56

Related issues

Related to Redmine - Defect #37379: Thumbnail macro does not work when a file is attached and preview is displayed immediatelyClosedGo MAEDA

Actions
Actions #1

Updated by Go MAEDA over 1 year ago

  • Target version set to Candidate for next minor release

Here is a decoded content of fix.patch. Since ActionMailer::Base has controller_path method (https://api.rubyonrails.org/v6.1/classes/ActionMailer/Base.html#method-c-controller_path), the fix should work as expected.

--- a/lib/redmine/wiki_formatting/macros.rb
+++ b/lib/redmine/wiki_formatting/macros.rb
@@ -281,7 +281,7 @@ module Redmine

         container = obj.is_a?(Journal) ? obj.journalized : obj
         attachments = container.attachments if container.respond_to?(:attachments)
-        if (controller_name == 'previews' || action_name == 'preview') && @attachments.present?
+        if (controller_path == 'previews' || action_name == 'preview') && @attachments.present?
           attachments = (attachments.to_a + @attachments).compact
         end
         if attachments.present? && (attachment = Attachment.latest_attach(attachments, filename))
Actions #2

Updated by Go MAEDA about 1 year ago

  • Related to Defect #37379: Thumbnail macro does not work when a file is attached and preview is displayed immediately added
Actions #3

Updated by Mizuki ISHIKAWA about 1 year ago

Thank you for fixing the issue. I have attached a patch that adds a test case which fails before the fix and passes after the fix is applied.

Actions #4

Updated by Go MAEDA about 1 year ago

  • Subject changed from If the email notification contains a thumbnail, the error message `undefined method `controller_name'` is displayed. to Exception during thumbnail macro to image tag conversion in emails
  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the fix. Thank you.

Actions #5

Updated by Go MAEDA about 1 year ago

  • Target version changed from Candidate for next minor release to 4.2.11
Actions

Also available in: Atom PDF