diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2017-07-19 17:32:56 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-08-07 15:31:45 +0300 |
commit | aae947cb1c1252a642e0464c61132ec2e965eb80 (patch) | |
tree | 6ea056b09a118f5be2aa4cbfe60abd9879472f79 /app/services/projects/gitlab_projects_import_service.rb | |
parent | 7c5757ad9a416c9947bb0e9fae9065af47da8a0d (diff) |
Fixes race condition in project uploads
Originally picked as: 3fc0dbcbebcd470fe14f8b5fb7ad55dc3912402e. But
given the internals changed, this was changed now. The changelog was
removed too.
Diffstat (limited to 'app/services/projects/gitlab_projects_import_service.rb')
-rw-r--r-- | app/services/projects/gitlab_projects_import_service.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/services/projects/gitlab_projects_import_service.rb b/app/services/projects/gitlab_projects_import_service.rb index 5ba1b6436f4..4ca6414b73b 100644 --- a/app/services/projects/gitlab_projects_import_service.rb +++ b/app/services/projects/gitlab_projects_import_service.rb @@ -22,8 +22,11 @@ module Projects private def import_upload_path - @import_upload_path ||= Gitlab::ImportExport - .import_upload_path(filename: "#{params[:namespace_id]}-#{params[:path]}") + @import_upload_path ||= Gitlab::ImportExport.import_upload_path(filename: tmp_filename) + end + + def tmp_filename + "#{SecureRandom.hex}_#{params[:path]}" end def file |