diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-08-13 22:28:22 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-08-13 22:28:22 +0400 |
commit | 1d63464c82db58763a0941c22ab8c3c973890a38 (patch) | |
tree | 98249433ecd93975e3326f42744c9c6217b879ce /lib/api/repositories.rb | |
parent | d8b769ec740f9e6d47c3885d99796e4ca9337cbc (diff) |
Fix repository archive
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/api/repositories.rb')
-rw-r--r-- | lib/api/repositories.rb | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 461ce4e59cf..42068bb343d 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -115,21 +115,13 @@ module API # GET /projects/:id/repository/archive get ":id/repository/archive", requirements: { format: Gitlab::Regex.archive_formats_regex } do authorize! :download_code, user_project - repo = user_project.repository - ref = params[:sha] - format = params[:format] - storage_path = Gitlab.config.gitlab.repository_downloads_path + file_path = ArchiveRepositoryService.new.execute(user_project, params[:sha], params[:format]) - file_path = repo.archive_repo(ref, storage_path, format) if file_path && File.exists?(file_path) data = File.open(file_path, 'rb').read - header["Content-Disposition"] = "attachment; filename=\"#{File.basename(file_path)}\"" - content_type MIME::Types.type_for(file_path).first.content_type - env['api.format'] = :binary - present data else not_found! |