Commit 38d407d7 authored by Jamie Schembri's avatar Jamie Schembri

Fix #48537 - Update avatar only via the projects API

parent a0935bf2
---
title: Allow updating a project's avatar without other params
merge_request:
author: Jamie Schembri
type: fixed
...@@ -260,7 +260,8 @@ module API ...@@ -260,7 +260,8 @@ module API
:snippets_enabled, :snippets_enabled,
:tag_list, :tag_list,
:visibility, :visibility,
:wiki_enabled :wiki_enabled,
:avatar
] ]
optional :name, type: String, desc: 'The name of the project' optional :name, type: String, desc: 'The name of the project'
optional :default_branch, type: String, desc: 'The default branch of the project' optional :default_branch, type: String, desc: 'The default branch of the project'
......
...@@ -1526,6 +1526,20 @@ describe API::Projects do ...@@ -1526,6 +1526,20 @@ describe API::Projects do
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(400)
end end
it 'updates avatar' do
project_param = {
avatar: fixture_file_upload('spec/fixtures/banana_sample.gif',
'image/gif')
}
put api("/projects/#{project3.id}", user), project_param
expect(response).to have_gitlab_http_status(200)
expect(json_response['avatar_url']).to eq('http://localhost/uploads/'\
'-/system/project/avatar/'\
"#{project3.id}/banana_sample.gif")
end
end end
context 'when authenticated as project master' do context 'when authenticated as project master' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment