]> source.dussan.org Git - redmine.git/commitdiff
"attachment:filename" should generate a link to preview instead of download (#26310...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 2 Jul 2017 09:54:24 +0000 (09:54 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 2 Jul 2017 09:54:24 +0000 (09:54 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@16738 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
test/unit/helpers/application_helper_test.rb

index 41a8056e8bd9bee84f5ab9a41fb8fb30bfd0a03d..52a405211f8b90cce7d024762d19b2b8befba5d6 100644 (file)
@@ -975,7 +975,7 @@ module ApplicationHelper
               attachments = options[:attachments] || []
               attachments += obj.attachments if obj.respond_to?(:attachments)
               if attachments && attachment = Attachment.latest_attach(attachments, name)
-                link = link_to_attachment(attachment, :only_path => only_path, :download => true, :class => 'attachment')
+                link = link_to_attachment(attachment, :only_path => only_path, :class => 'attachment')
               end
             when 'project'
               if p = Project.visible.where("identifier = :s OR LOWER(name) = :s", :s => name.downcase).first
index ca56412f73858809f36d8f3f1291f07d613e5801..020b4636c96c47ed4813f77a1b3b0737b762c380 100644 (file)
@@ -667,7 +667,7 @@ RAW
 
   def test_attachment_links
     text = 'attachment:error281.txt'
-    result = link_to("error281.txt", "/attachments/download/1/error281.txt",
+    result = link_to("error281.txt", "/attachments/1/error281.txt",
                      :class => "attachment")
     assert_equal "<p>#{result}</p>",
                  textilizable(text,
@@ -679,7 +679,7 @@ RAW
     set_tmp_attachments_directory
     a1 = Attachment.generate!(:filename => "test.txt", :created_on => 1.hour.ago)
     a2 = Attachment.generate!(:filename => "test.txt")
-    result = link_to("test.txt", "/attachments/download/#{a2.id}/test.txt",
+    result = link_to("test.txt", "/attachments/#{a2.id}/test.txt",
                      :class => "attachment")
     assert_equal "<p>#{result}</p>",
                  textilizable('attachment:test.txt', :attachments => [a1, a2])