Commit bd2736fb authored by Robert Speicher's avatar Robert Speicher

Merge branch 'tc-fix-38088' into 'master'

Ensure a valid mount_point is used by the AvatarUploader

See merge request gitlab-org/gitlab!24800
parents d6ed219c df0a334e
...@@ -25,6 +25,10 @@ class AvatarUploader < GitlabUploader ...@@ -25,6 +25,10 @@ class AvatarUploader < GitlabUploader
self.class.absolute_path(upload) self.class.absolute_path(upload)
end end
def mounted_as
super || 'avatar'
end
private private
def dynamic_segment def dynamic_segment
......
---
title: Ensure a valid mount_point is used by the AvatarUploader
merge_request: 24800
author:
type: fixed
...@@ -139,6 +139,18 @@ describe API::Geo do ...@@ -139,6 +139,18 @@ describe API::Geo do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
end end
context 'avatar has mount_point nil' do
it 'responds with 200 with X-Sendfile' do
upload.update(mount_point: nil)
get api("/geo/transfers/avatar/#{upload.id}"), headers: req_header
expect(response).to have_gitlab_http_status(200)
expect(response.headers['Content-Type']).to eq('application/octet-stream')
expect(response.headers['X-Sendfile']).to eq(user.avatar.path)
end
end
end end
describe 'GET /geo/transfers/file/1' do describe 'GET /geo/transfers/file/1' 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