]> source.dussan.org Git - redmine.git/commitdiff
Show repository images inline when clicking 'View' (#10362).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 7 Jun 2012 17:00:29 +0000 (17:00 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 7 Jun 2012 17:00:29 +0000 (17:00 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9776 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/repositories_controller.rb
test/functional/repositories_subversion_controller_test.rb

index d74b59b6018b8c994e607d260e3231d0dd4f8eeb..f93bedeade30e01ad2d9dda39b7d839998a76a58 100644 (file)
@@ -176,6 +176,7 @@ class RepositoriesController < ApplicationController
       send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) }
       send_type = Redmine::MimeType.of(@path)
       send_opt[:type] = send_type.to_s if send_type
+      send_opt[:disposition] = (Redmine::MimeType.is_type?('image', @path) && !is_raw ? 'inline' : 'attachment')
       send_data @content, send_opt
     else
       # Prevent empty lines when displaying a file with Windows style eol
index 7176cd59e1a79bc1b297d5a0cc556ae1d0666114..5bee2a3b62fe9dd3c7a1bff4343e86779142fe8a 100644 (file)
@@ -185,6 +185,13 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
       end
     end
 
+    def test_entry_should_send_images_inline
+      get :entry, :id => PRJ_ID,
+          :path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'rubylogo.gif'])[:param]
+      assert_response :success
+      assert_equal 'inline; filename="rubylogo.gif"', response.headers['Content-Disposition']
+    end
+
     def test_entry_at_given_revision
       assert_equal 0, @repository.changesets.count
       @repository.fetch_changesets