]> source.dussan.org Git - redmine.git/commitdiff
Fixed: version files in Files module cannot be downloaded if issue tracking is disabl...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 29 Nov 2011 19:36:49 +0000 (19:36 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 29 Nov 2011 19:36:49 +0000 (19:36 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7984 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/version.rb
test/fixtures/attachments.yml
test/functional/attachments_controller_test.rb

index b5f34e97ffd35f1842dafc622f2c9b22f83de84a..3340be77ee471bf614d8130f9908e5dd340fb5c4 100644 (file)
@@ -43,6 +43,11 @@ class Version < ActiveRecord::Base
     user.allowed_to?(:view_issues, self.project)
   end
 
+  # Version files have same visibility as project files
+  def attachments_visible?(*args)
+    project.present? && project.attachments_visible?(*args)
+  end
+
   def start_date
     @start_date ||= fixed_issues.minimum('start_date')
   end
index 32d7cabc15c1c451d7b1b8d86f2dc32d51543449..604ac1ac4da44192d4496e0a445af59ce8a9a6ee 100644 (file)
@@ -102,7 +102,7 @@ attachments_009:
   container_type: Version
   container_id: 1
   downloads: 0
-  disk_filename: 060719210727_version_file.zip
+  disk_filename: 060719210727_archive.zip
   digest: b91e08d0cf966d5c6ff411bd8c4cc3a2
   id: 9
   filesize: 452
index 50b19c26084dbaada847ea6694373bbd6787c6c7..625a21eb5a13d67f593494368c6090005f5c273a 100644 (file)
@@ -198,6 +198,12 @@ class AttachmentsControllerTest < ActionController::TestCase
     set_tmp_attachments_directory
   end
 
+  def test_download_version_file_with_issue_tracking_disabled
+    Project.find(1).disable_module! :issue_tracking
+    get :download, :id => 9
+    assert_response :success
+  end
+
   def test_download_should_assign_content_type_if_blank
     Attachment.find(4).update_attribute(:content_type, '')