summaryrefslogtreecommitdiff
path: root/lib/api/project_export.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-15 15:42:17 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-15 15:42:17 +0000
commit44fdf983bd35328dd577d3d3650d14163ef3e2b6 (patch)
tree84ff300d056cfbabb5a0fe2a9cbaa80aaeab1cc5 /lib/api/project_export.rb
parentbc9fa07b26184b5c94808f704db6ea1ac81bf4de (diff)
downloadgitlab-ce-44fdf983bd35328dd577d3d3650d14163ef3e2b6.tar.gz
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'lib/api/project_export.rb')
-rw-r--r--lib/api/project_export.rb17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/api/project_export.rb b/lib/api/project_export.rb
index ef6a8f1a396..9fd9d13a20c 100644
--- a/lib/api/project_export.rb
+++ b/lib/api/project_export.rb
@@ -2,15 +2,8 @@
module API
class ProjectExport < Grape::API
- helpers do
- def throttled?(action)
- rate_limiter.throttled?(action, scope: [current_user, action, user_project])
- end
+ helpers Helpers::RateLimiter
- def rate_limiter
- ::Gitlab::ApplicationRateLimiter
- end
- end
before do
not_found! unless Gitlab::CurrentSettings.project_export_enabled?
authorize_admin_project
@@ -32,9 +25,7 @@ module API
detail 'This feature was introduced in GitLab 10.6.'
end
get ':id/export/download' do
- if throttled?(:project_download_export)
- render_api_error!({ error: 'This endpoint has been requested too many times. Try again later.' }, 429)
- end
+ check_rate_limit! :project_download_export, [current_user, :project_download_export, user_project]
if user_project.export_file_exists?
present_carrierwave_file!(user_project.export_file)
@@ -54,9 +45,7 @@ module API
end
end
post ':id/export' do
- if throttled?(:project_export)
- render_api_error!({ error: 'This endpoint has been requested too many times. Try again later.' }, 429)
- end
+ check_rate_limit! :project_export, [current_user, :project_export, user_project]
project_export_params = declared_params(include_missing: false)
after_export_params = project_export_params.delete(:upload) || {}