diff --git a/lib/redmine/wiki_formatting/macros.rb b/lib/redmine/wiki_formatting/macros.rb
index 731c1bc00..d3a728963 100644
--- a/lib/redmine/wiki_formatting/macros.rb
+++ b/lib/redmine/wiki_formatting/macros.rb
@@ -236,8 +236,11 @@ module Redmine
size = nil unless size > 0
if obj && obj.respond_to?(:attachments) && attachment = Attachment.latest_attach(obj.attachments, filename)
title = options[:title] || attachment.title
- img = image_tag(url_for(:controller => 'attachments', :action => 'thumbnail', :id => attachment, :size => size), :alt => attachment.filename)
- link_to(img, url_for(:controller => 'attachments', :action => 'show', :id => attachment), :class => 'thumbnail', :title => title)
+ thumbnail_url = url_for(:controller => 'attachments', :action => 'thumbnail', :id => attachment, :size => size, :only_path => false)
+ image_url = url_for(:controller => 'attachments', :action => 'show', :id => attachment, :only_path => false)
+
+ img = image_tag(thumbnail_url, :alt => attachment.filename)
+ link_to(img, image_url, :class => 'thumbnail', :title => title)
else
raise "Attachment #{filename} not found"
end
diff --git a/test/unit/lib/redmine/wiki_formatting/macros_test.rb b/test/unit/lib/redmine/wiki_formatting/macros_test.rb
index da0094c0b..443b6f4d8 100644
--- a/test/unit/lib/redmine/wiki_formatting/macros_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/macros_test.rb
@@ -302,8 +302,8 @@ RAW
end
def test_macro_thumbnail
- link = link_to(''.html_safe,
- "/attachments/17",
+ link = link_to('
'.html_safe,
+ "http://test.host/attachments/17",
:class => "thumbnail",
:title => "testfile.PNG")
assert_equal "
#{link}
", @@ -311,8 +311,8 @@ RAW end def test_macro_thumbnail_with_size - link = link_to('#{link}
", @@ -320,8 +320,8 @@ RAW end def test_macro_thumbnail_with_title - link = link_to('#{link}
",