Commit ca5b4e3d authored by George Tsiolis's avatar George Tsiolis

Update projects import service

- Remove Gitlab::ImportExport::ProjectCreator from GitlabProjectsImportService
- Override ::Projects::CreateService params
parent 7611ec4e
...@@ -5,11 +5,15 @@ module Projects ...@@ -5,11 +5,15 @@ module Projects
end end
def execute def execute
params[:file] = Gitlab::ProjectTemplate.find(params[:template_name]).file template_name = params.delete(:template_name)
file = Gitlab::ProjectTemplate.find(template_name).file
params[:file] = file
GitlabProjectsImportService.new(current_user, params).execute
GitlabProjectsImportService.new(@current_user, @params).execute
ensure ensure
params[:file]&.close file&.close
end end
end end
end end
...@@ -11,12 +11,14 @@ module Projects ...@@ -11,12 +11,14 @@ module Projects
def execute def execute
FileUtils.mkdir_p(File.dirname(import_upload_path)) FileUtils.mkdir_p(File.dirname(import_upload_path))
file = params.delete(:file)
FileUtils.copy_entry(file.path, import_upload_path) FileUtils.copy_entry(file.path, import_upload_path)
Gitlab::ImportExport::ProjectCreator.new(params[:namespace_id], params[:import_type] = 'gitlab_project'
current_user, params[:import_source] = import_upload_path
import_upload_path,
params[:path]).execute ::Projects::CreateService.new(current_user, params).execute
end end
private private
...@@ -28,9 +30,5 @@ module Projects ...@@ -28,9 +30,5 @@ module Projects
def tmp_filename def tmp_filename
SecureRandom.hex SecureRandom.hex
end end
def file
params[:file]
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment