diff options
author | James Lopez <james@jameslopez.es> | 2018-07-26 12:55:21 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-08-02 11:50:19 +0200 |
commit | 07009a1f4893652e152794ae8160a2f46e00772c (patch) | |
tree | a9c03b82c4b28dfa3150cbd4735c07483b9547fb /lib/gitlab/template_helper.rb | |
parent | 3cc420b8094ec0240b473205fc886bd9c728cc5d (diff) | |
download | gitlab-ce-07009a1f4893652e152794ae8160a2f46e00772c.tar.gz |
Add Object Storage to GitLab project import
- Refactor uploads manager
- Refactor importer, update import spec
- Add more object storage specs
Diffstat (limited to 'lib/gitlab/template_helper.rb')
-rw-r--r-- | lib/gitlab/template_helper.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/gitlab/template_helper.rb b/lib/gitlab/template_helper.rb index 3b8e45e0688..3918abaab45 100644 --- a/lib/gitlab/template_helper.rb +++ b/lib/gitlab/template_helper.rb @@ -2,11 +2,17 @@ module Gitlab module TemplateHelper include Gitlab::Utils::StrongMemoize - def prepare_template_environment(file_path) - return unless file_path.present? + def prepare_template_environment(file) + return unless file&.path.present? - FileUtils.mkdir_p(File.dirname(import_upload_path)) - FileUtils.copy_entry(file_path, import_upload_path) + if Gitlab::ImportExport.object_storage? + params[:import_export_upload] = ImportExportUpload.new(import_file: file) + else + FileUtils.mkdir_p(File.dirname(import_upload_path)) + FileUtils.copy_entry(file.path, import_upload_path) + + params[:import_source] = import_upload_path + end end def import_upload_path |