Commit cb35a80e49ff3cdf3bd240640fc4d0dbd051922a

Authored by Dmitriy Zaporozhets
2 parents cb6fcb65 87d2a763

Merge pull request #993 from veprbl/fix_archiving_prefix

Download button: put files into a directory
Showing 1 changed file with 4 additions and 1 deletions   Show diff stats
app/roles/repository.rb
@@ -115,10 +115,13 @@ module Repository @@ -115,10 +115,13 @@ module Repository
115 storage_path = File.join(Rails.root, "tmp", "repositories", self.code) 115 storage_path = File.join(Rails.root, "tmp", "repositories", self.code)
116 file_path = File.join(storage_path, file_name) 116 file_path = File.join(storage_path, file_name)
117 117
  118 + # Put files into a directory before archiving
  119 + prefix = self.code + "/"
  120 +
118 # Create file if not exists 121 # Create file if not exists
119 unless File.exists?(file_path) 122 unless File.exists?(file_path)
120 FileUtils.mkdir_p storage_path 123 FileUtils.mkdir_p storage_path
121 - file = self.repo.archive_to_file(ref, nil, file_path) 124 + file = self.repo.archive_to_file(ref, prefix, file_path)
122 end 125 end
123 126
124 file_path 127 file_path