summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-06-26 17:05:48 -0700
committerStan Hu <stanhu@gmail.com>2018-07-03 09:57:15 -0700
commite61f66b3d16cf097af8fbf3072018fd7d9ec8b67 (patch)
tree9bd0d94a016f792b598fc00751c0b9e1ff8b6ffe
parentcd5789415b6e561564073693243e890e79596ed2 (diff)
downloadgitlab-ce-e61f66b3d16cf097af8fbf3072018fd7d9ec8b67.tar.gz
When moving issues, don't attempt to move files in object storage
Closes #48505
-rw-r--r--changelogs/unreleased/sh-fix-move-issue-with-object-storage.yml5
-rw-r--r--lib/gitlab/gfm/uploads_rewriter.rb2
-rw-r--r--spec/lib/gitlab/gfm/uploads_rewriter_spec.rb19
3 files changed, 25 insertions, 1 deletions
diff --git a/changelogs/unreleased/sh-fix-move-issue-with-object-storage.yml b/changelogs/unreleased/sh-fix-move-issue-with-object-storage.yml
new file mode 100644
index 00000000000..e2df15a2847
--- /dev/null
+++ b/changelogs/unreleased/sh-fix-move-issue-with-object-storage.yml
@@ -0,0 +1,5 @@
+---
+title: When moving issues, don't attempt to move files in object storage
+merge_request:
+author:
+type: fixed
diff --git a/lib/gitlab/gfm/uploads_rewriter.rb b/lib/gitlab/gfm/uploads_rewriter.rb
index b6eeb5d9a2b..ac00f3e2f8d 100644
--- a/lib/gitlab/gfm/uploads_rewriter.rb
+++ b/lib/gitlab/gfm/uploads_rewriter.rb
@@ -48,7 +48,7 @@ module Gitlab
def find_file(project, secret, file)
uploader = FileUploader.new(project, secret: secret)
uploader.retrieve_from_store!(file)
- uploader.file
+ uploader.file if uploader.object_store == ObjectStorage::Store::LOCAL
end
# Because the uploaders use 'move_to_store' we must have a temporary
diff --git a/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb b/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb
index 13df8531b63..4d72e60a8b3 100644
--- a/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb
+++ b/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb
@@ -62,5 +62,24 @@ 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