diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-22 15:08:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-22 15:08:58 +0300 |
commit | ed45528885b7b44c61f18175fe7cdbda12360669 (patch) | |
tree | 3d27c00a8a83d569cf238eaa05b7eb24b7a28a8d /app | |
parent | ab85af0f318ccbcfdd508e7a2f85788f26831785 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/repositories_controller.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb index d0fb814948f..1cb9e1d2c9b 100644 --- a/app/controllers/projects/repositories_controller.rb +++ b/app/controllers/projects/repositories_controller.rb @@ -3,11 +3,13 @@ class Projects::RepositoriesController < Projects::ApplicationController include ExtractsPath include StaticObjectExternalStorage + include Gitlab::RateLimitHelpers prepend_before_action(only: [:archive]) { authenticate_sessionless_user!(:archive) } # Authorize before_action :require_non_empty_project, except: :create + before_action :archive_rate_limit!, only: :archive before_action :assign_archive_vars, only: :archive before_action :assign_append_sha, only: :archive before_action :authorize_download_code! @@ -34,6 +36,12 @@ class Projects::RepositoriesController < Projects::ApplicationController private + def archive_rate_limit! + if archive_rate_limit_reached?(current_user, @project) + render plain: ::Gitlab::RateLimitHelpers::ARCHIVE_RATE_LIMIT_REACHED_MESSAGE, status: :too_many_requests + end + end + def repo_params @repo_params ||= { ref: @ref, path: params[:path], format: params[:format], append_sha: @append_sha } end |