diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index d384ffa8b..cd5f60063 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -559,8 +559,7 @@ module ApplicationHelper
filename, ext, alt, alttext = $1.downcase, $2, $3, $4
# search for the picture in attachments
if found = Attachment.latest_attach(attachments, filename)
- image_url = url_for :only_path => only_path, :controller => 'attachments',
- :action => 'download', :id => found
+ image_url = download_named_attachment_path(found, found.filename, :only_path => only_path)
desc = found.description.to_s.gsub('"', '')
if !desc.blank? && alttext.blank?
alt = " title=\"#{desc}\" alt=\"#{desc}\""
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index e097efe52..7e4505a74 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -132,12 +132,12 @@ RAW
def test_attached_images
to_test = {
- 'Inline image: !logo.gif!' => 'Inline image: ',
- 'Inline image: !logo.GIF!' => 'Inline image:
',
+ 'Inline image: !logo.gif!' => 'Inline image:
',
+ 'Inline image: !logo.GIF!' => 'Inline image:
',
'No match: !ogo.gif!' => 'No match:
',
'No match: !ogo.GIF!' => 'No match:
',
# link image
- '!logo.gif!:http://foo.bar/' => '
',
+ '!logo.gif!:http://foo.bar/' => '
',
}
attachments = Attachment.all
to_test.each { |text, result| assert_equal "
#{result}
", textilizable(text, :attachments => attachments) } @@ -183,13 +183,13 @@ RAW to_test = { 'Inline image: !testtest.jpg!' => - 'Inline image:#{result}
", textilizable(text, :attachments => attachments) }