diff options
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! |