Commit c60d0efe authored by Kamil Trzciński's avatar Kamil Trzciński

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
parents 2fdc7c1f ec85deba
......@@ -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
......
---
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
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