fix an issue with local files

This commit is contained in:
Micaël Bergeron 2018-06-28 11:25:40 -04:00 committed by Stan Hu
parent cebdd267e6
commit 91c9c4b728
2 changed files with 8 additions and 25 deletions

View file

@ -162,12 +162,14 @@ class FileUploader < GitlabUploader
end
def copy_file(file)
if file_storage?
store!(file)
else
self.file = file.copy_to(store_path)
record_upload # after_store is not triggered
end
to_path = if file_storage?
File.join(self.class.root, store_path)
else
store_path
end
self.file = file.copy_to(to_path)
record_upload # after_store is not triggered
end
private

View file

@ -80,24 +80,5 @@ describe Gitlab::Gfm::UploadsRewriter do
subject { rewriter.files }
it { is_expected.to be_an(Array) }
end
describe 'with object storage' do
before do
stub_uploads_object_storage(uploader: FileUploader)
zip_uploader.migrate!(FileUploader::Store::REMOTE)
end
describe '#needs_rewrite?' do
subject { rewriter.needs_rewrite? }
it { is_expected.to eq false }
end
describe '#files' do
subject { rewriter.files }
it { is_expected.to eq([]) }
end
end
end
end