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
end
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
params[:file]&.close
file&.close
end
end
end
......@@ -11,12 +11,14 @@ module Projects
def execute
FileUtils.mkdir_p(File.dirname(import_upload_path))
file = params.delete(:file)
FileUtils.copy_entry(file.path, import_upload_path)
Gitlab::ImportExport::ProjectCreator.new(params[:namespace_id],
current_user,
import_upload_path,
params[:path]).execute
params[:import_type] = 'gitlab_project'
params[:import_source] = import_upload_path
::Projects::CreateService.new(current_user, params).execute
end
private
......@@ -28,9 +30,5 @@ module Projects
def tmp_filename
SecureRandom.hex
end
def file
params[:file]
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