Merge branch 'stop-signing-avatar-paths' into 'master'
Speed up avatar URLs with object storage Closes #43065 See merge request gitlab-org/gitlab-ce!26858
This commit is contained in:
commit
c60d0efe0d
3 changed files with 18 additions and 0 deletions
|
@ -46,6 +46,10 @@ module RecordsUploads
|
|||
File.join(store_dir, filename.to_s)
|
||||
end
|
||||
|
||||
def filename
|
||||
upload&.path ? File.basename(upload.path) : super
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# rubocop: disable CodeReuse/ActiveRecord
|
||||
|
|
5
changelogs/unreleased/stop-signing-avatar-paths.yml
Normal file
5
changelogs/unreleased/stop-signing-avatar-paths.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Speed up generation of avatar URLs when using object storage
|
||||
merge_request:
|
||||
author:
|
||||
type: performance
|
|
@ -94,4 +94,13 @@ describe RecordsUploads do
|
|||
expect { uploader.remove! }.to change { Upload.count }.from(1).to(0)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#filename' do
|
||||
it 'gets the filename from the path recorded in the database, not CarrierWave' do
|
||||
uploader.store!(upload_fixture('rails_sample.jpg'))
|
||||
expect_any_instance_of(GitlabUploader).not_to receive(:filename)
|
||||
|
||||
expect(uploader.filename).to eq('rails_sample.jpg')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue