diff options
author | Micaƫl Bergeron <mbergeron@gitlab.com> | 2018-06-28 11:25:40 -0400 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-07-03 09:57:15 -0700 |
commit | 91c9c4b72888f95fc07d14a008ec48c8114b4e41 (patch) | |
tree | a0cf98e670ee9b768ec55ba6cdf09ee7e6a531c8 | |
parent | cebdd267e672c75696cd534bb89d10fda8de129f (diff) | |
download | gitlab-ce-91c9c4b72888f95fc07d14a008ec48c8114b4e41.tar.gz |
fix an issue with local files
-rw-r--r-- | app/uploaders/file_uploader.rb | 14 | ||||
-rw-r--r-- | spec/lib/gitlab/gfm/uploads_rewriter_spec.rb | 19 |
2 files changed, 8 insertions, 25 deletions
diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb index 28399f1e051..73606eb9f83 100644 --- a/app/uploaders/file_uploader.rb +++ b/app/uploaders/file_uploader.rb @@ -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 diff --git a/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb b/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb index 9a3e958515f..bf42c583499 100644 --- a/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb +++ b/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb @@ -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 |