summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-06-24 10:22:44 +0000
committerRobert Speicher <rspeicher@gmail.com>2016-06-24 11:31:41 -0400
commitac7cea308467709413f7a67b9e95fd0a0e2dcafe (patch)
tree808d51109ed3142c6fd99b523b4fb85098b78643 /app
parent12af7464cf94dcb4d1983f1b32934e67567e2940 (diff)
downloadgitlab-ce-ac7cea308467709413f7a67b9e95fd0a0e2dcafe.tar.gz
Merge branch 'fix/gitlab-import-project-file-fix' into 'master'
Fix temp file being deleted after the request while importing a GitLab project Fixes https://gitlab.com/gitlab-com/infrastructure/issues/151 In production, the temporary uploaded file is getting deleted straight after the request so the Sidekiq worker is unable to find it in `/tmp` Also, improved erroring/logging of this situation. See merge request !4894
Diffstat (limited to 'app')
-rw-r--r--app/controllers/import/gitlab_projects_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/import/gitlab_projects_controller.rb b/app/controllers/import/gitlab_projects_controller.rb
index f99aa490d3e..513348c39af 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 = project_params[:file].path + "-import"
+
+ FileUtils.copy_entry(project_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?