From 8440435214257af1b5e9a79e52a0e9b6749b60f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarka=20Ko=C5=A1anov=C3=A1?= Date: Mon, 10 Sep 2018 19:03:33 +0200 Subject: [PATCH] Fix workhorse temp path for namespace uploads --- app/uploaders/namespace_file_uploader.rb | 4 ++++ changelogs/unreleased/fix-namespace-upload.yml | 5 +++++ spec/uploaders/namespace_file_uploader_spec.rb | 6 ++++++ 3 files changed, 15 insertions(+) create mode 100644 changelogs/unreleased/fix-namespace-upload.yml diff --git a/app/uploaders/namespace_file_uploader.rb b/app/uploaders/namespace_file_uploader.rb index b0154f85a5c..4965bd7f057 100644 --- a/app/uploaders/namespace_file_uploader.rb +++ b/app/uploaders/namespace_file_uploader.rb @@ -21,6 +21,10 @@ class NamespaceFileUploader < FileUploader File.join(model.id.to_s) end + def self.workhorse_local_upload_path + File.join(options.storage_path, 'uploads', TMP_UPLOAD_PATH) + end + # Re-Override def store_dir store_dirs[object_store] diff --git a/changelogs/unreleased/fix-namespace-upload.yml b/changelogs/unreleased/fix-namespace-upload.yml new file mode 100644 index 00000000000..383d79a998f --- /dev/null +++ b/changelogs/unreleased/fix-namespace-upload.yml @@ -0,0 +1,5 @@ +--- +title: Fix workhorse temp path for namespace uploads +merge_request: 21650 +author: +type: fixed diff --git a/spec/uploaders/namespace_file_uploader_spec.rb b/spec/uploaders/namespace_file_uploader_spec.rb index eafbea07e10..799c6db57fa 100644 --- a/spec/uploaders/namespace_file_uploader_spec.rb +++ b/spec/uploaders/namespace_file_uploader_spec.rb @@ -40,6 +40,12 @@ describe NamespaceFileUploader do end end + describe '#workhorse_local_upload_path' do + it 'returns the correct path in uploads directory' do + expect(described_class.workhorse_local_upload_path).to end_with('/uploads/tmp/uploads') + end + end + describe "#migrate!" do before do uploader.store!(fixture_file_upload(File.join('spec/fixtures/doc_sample.txt')))