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>2021-07-20 12:55:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-20 12:55:51 +0300
commite8d2c2579383897a1dd7f9debd359abe8ae8373d (patch)
treec42be41678c2586d49a75cabce89322082698334 /lib/api/group_avatar.rb
parentfc845b37ec3a90aaa719975f607740c22ba6a113 (diff)
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'lib/api/group_avatar.rb')
-rw-r--r--lib/api/group_avatar.rb22
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/api/group_avatar.rb b/lib/api/group_avatar.rb
index ddf6787f913..9063040c763 100644
--- a/lib/api/group_avatar.rb
+++ b/lib/api/group_avatar.rb
@@ -6,15 +6,27 @@ module API
feature_category :subgroups
- resource :groups do
+ params do
+ requires :id, type: String, desc: 'The ID of a group'
+ end
+ resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
desc 'Download the group avatar' do
detail 'This feature was introduced in GitLab 14.0'
end
- params do
- requires :id, type: String, desc: 'The group id'
- end
get ':id/avatar' do
- present_carrierwave_file!(user_group.avatar)
+ avatar = user_group.avatar
+
+ not_found!('Avatar') if avatar.blank?
+
+ header(
+ 'Content-Disposition',
+ ActionDispatch::Http::ContentDisposition.format(
+ disposition: 'attachment',
+ filename: avatar.filename
+ )
+ )
+
+ present_carrierwave_file!(avatar)
end
end
end