summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-07-21 14:31:16 +0000
committerGo MAEDA <maeda@farend.jp>2022-07-21 14:31:16 +0000
commit9730f6f8ecf529070d5f54140cdac00cb2b0cd78 (patch)
treee2fc60449456c1f5fb0dc7087d39960ad7f76ead /lib
parent5740256ed928d81741510067e2594fd061dbb8e5 (diff)
downloadredmine-9730f6f8ecf529070d5f54140cdac00cb2b0cd78.tar.gz
redmine-9730f6f8ecf529070d5f54140cdac00cb2b0cd78.zip
Merged r21716 and r21719 from trunk to 5.0-stable (#37379).
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@21735 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/wiki_formatting/macros.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/redmine/wiki_formatting/macros.rb b/lib/redmine/wiki_formatting/macros.rb
index 0727d6e26..42096b9a3 100644
--- a/lib/redmine/wiki_formatting/macros.rb
+++ b/lib/redmine/wiki_formatting/macros.rb
@@ -278,8 +278,12 @@ module Redmine
size = size.to_i
size = 200 unless size > 0
- if obj && obj.respond_to?(:attachments) &&
- attachment = Attachment.latest_attach(obj.attachments, filename)
+
+ attachments = obj.attachments if obj.respond_to?(:attachments)
+ if (controller_name == 'previews' || action_name == 'preview') && @attachments.present?
+ attachments = (attachments.to_a + @attachments).compact
+ end
+ if attachments.present? && (attachment = Attachment.latest_attach(attachments, filename))
title = options[:title] || attachment.title
thumbnail_url =
url_for(:controller => 'attachments', :action => 'thumbnail',