Commit 91c9c4b7 authored by Micaël Bergeron's avatar Micaël Bergeron Committed by Stan Hu

fix an issue with local files

parent cebdd267
......@@ -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
......
......@@ -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
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