Welcome to mirror list, hosted at ThFree Co, Russian Federation.

repositories_controller.rb « projects « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d1a6fecba20b2815a8e6cb1e11fb7dd3fc5ef2f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Projects::RepositoriesController < Projects::ApplicationController
  # Authorize
  before_filter :authorize_read_project!
  before_filter :authorize_code_access!
  before_filter :require_non_empty_project

  def stats
    @stats = Gitlab::Git::Stats.new(@repository.raw, @repository.root_ref)
    @graph = @stats.graph
  end

  def archive
    unless can?(current_user, :download_code, @project)
      render_404 and return
    end

    storage_path = Gitlab.config.gitlab.repository_downloads_path

    file_path = @repository.archive_repo(params[:ref], storage_path, params[:format].downcase)

    if file_path
      # Send file to user
      send_file file_path
    else
      render_404
    end
  end
end