From 46b89a270f7eef15f6d8e41c79600795265054fb Mon Sep 17 00:00:00 2001 From: James Lopez Date: Fri, 24 Jun 2016 10:50:23 +0200 Subject: Fix tmp file being deleted after the request plus some cleanup and improved erroring for this situation --- app/controllers/import/gitlab_projects_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/controllers/import') diff --git a/app/controllers/import/gitlab_projects_controller.rb b/app/controllers/import/gitlab_projects_controller.rb index f99aa490d3e..b521daa03aa 100644 --- a/app/controllers/import/gitlab_projects_controller.rb +++ b/app/controllers/import/gitlab_projects_controller.rb @@ -12,9 +12,13 @@ class Import::GitlabProjectsController < Import::BaseController return redirect_back_or_default(options: { alert: "You need to upload a GitLab project export archive." }) end + imported_file = params[:file].path + "-import" + + FileUtils.copy_entry(params[:file].path, imported_file) + @project = Gitlab::ImportExport::ProjectCreator.new(project_params[:namespace_id], current_user, - File.expand_path(project_params[:file].path), + File.expand_path(imported_file), project_params[:path]).execute if @project.saved? -- cgit v1.2.1