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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-06 00:07:40 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-06 00:07:40 +0300
commit134fe182008dc13a16f12d723aa73771efb1a6a2 (patch)
tree727c94937346d31a5e2692546d16296f069d09fe /app/controllers/projects/raw_controller.rb
parent6a7cc8c14727f6fac64a5be6838764d8d5d41468 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/projects/raw_controller.rb')
-rw-r--r--app/controllers/projects/raw_controller.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb
index c94fdd9483d..985587268c5 100644
--- a/app/controllers/projects/raw_controller.rb
+++ b/app/controllers/projects/raw_controller.rb
@@ -19,14 +19,16 @@ class Projects::RawController < Projects::ApplicationController
private
def show_rate_limit
- limiter = ::Gitlab::ActionRateLimiter.new(action: :show_raw_controller)
+ if rate_limiter.throttled?(:show_raw_controller, scope: [@project, @commit, @path], threshold: raw_blob_request_limit)
+ rate_limiter.log_request(request, :raw_blob_request_limit, current_user)
- return unless limiter.throttled?([@project, @commit, @path], raw_blob_request_limit)
-
- limiter.log_request(request, :raw_blob_request_limit, current_user)
+ flash[:alert] = _('You cannot access the raw file. Please wait a minute.')
+ redirect_to project_blob_path(@project, File.join(@ref, @path)), status: :too_many_requests
+ end
+ end
- flash[:alert] = _('You cannot access the raw file. Please wait a minute.')
- redirect_to project_blob_path(@project, File.join(@ref, @path)), status: :too_many_requests
+ def rate_limiter
+ ::Gitlab::ApplicationRateLimiter
end
def raw_blob_request_limit