summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-07-10 16:23:45 +0200
committerJames Lopez <james@jameslopez.es>2018-07-10 16:23:45 +0200
commit2c1e66d4d2124ec3d6101a6c5586867139f6fd20 (patch)
treede07b9b46ac24a866d196e57472df5f9e70bc288
parent874a4ff16ab883f3b22f8e11474522af120bfa86 (diff)
downloadgitlab-ce-2c1e66d4d2124ec3d6101a6c5586867139f6fd20.tar.gz
Fix avatar saver and spec
-rw-r--r--lib/gitlab/import_export/avatar_saver.rb11
-rw-r--r--spec/lib/gitlab/import_export/avatar_saver_spec.rb3
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/gitlab/import_export/avatar_saver.rb b/lib/gitlab/import_export/avatar_saver.rb
index 998c21e2586..848c05f116b 100644
--- a/lib/gitlab/import_export/avatar_saver.rb
+++ b/lib/gitlab/import_export/avatar_saver.rb
@@ -11,7 +11,12 @@ module Gitlab
def save
return true unless @project.avatar.exists?
- copy_files(avatar_path, avatar_export_path)
+ Gitlab::ImportExport::UploadsManager.new(
+ project: @project,
+ shared: @shared,
+ relative_export_path: 'avatar',
+ from: avatar_path
+ ).copy
rescue => e
@shared.error(e)
false
@@ -19,10 +24,6 @@ module Gitlab
private
- def avatar_export_path
- File.join(@shared.export_path, 'avatar', @project.avatar_identifier)
- end
-
def avatar_path
@project.avatar.path
end
diff --git a/spec/lib/gitlab/import_export/avatar_saver_spec.rb b/spec/lib/gitlab/import_export/avatar_saver_spec.rb
index 2223f163177..792596bfaa5 100644
--- a/spec/lib/gitlab/import_export/avatar_saver_spec.rb
+++ b/spec/lib/gitlab/import_export/avatar_saver_spec.rb
@@ -9,6 +9,7 @@ describe Gitlab::ImportExport::AvatarSaver do
before do
FileUtils.mkdir_p("#{shared.export_path}/avatar/")
allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path)
+ stub_feature_flags(import_export_object_storage: false)
end
after do
@@ -18,6 +19,8 @@ describe Gitlab::ImportExport::AvatarSaver do
it 'saves a project avatar' do
described_class.new(project: project_with_avatar, shared: shared).save
+ puts "#{shared.export_path}/avatar/dk.png"
+
expect(File).to exist("#{shared.export_path}/avatar/dk.png")
end