summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/services/projects/gitlab_projects_import_service.rb7
-rw-r--r--lib/gitlab/import_export.rb4
-rw-r--r--spec/features/projects/import_export/import_file_spec.rb1
3 files changed, 7 insertions, 5 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
diff --git a/lib/gitlab/import_export.rb b/lib/gitlab/import_export.rb
index 30b536383f9..3470a09eaf0 100644
--- a/lib/gitlab/import_export.rb
+++ b/lib/gitlab/import_export.rb
@@ -15,9 +15,7 @@ module Gitlab
end
def import_upload_path(filename:)
- milliseconds = Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond)
-
- File.join(storage_path, 'uploads', "#{milliseconds}-#{filename}")
+ File.join(storage_path, 'uploads', filename)
end
def project_filename
diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb
index c0cfb9eafe2..9b4235d9186 100644
--- a/spec/features/projects/import_export/import_file_spec.rb
+++ b/spec/features/projects/import_export/import_file_spec.rb
@@ -31,6 +31,7 @@ feature 'Import/Export - project import integration test', js: true do
expect(page).to have_content('GitLab project export')
expect(URI.parse(current_url).query).to eq("namespace_id=#{namespace.id}&path=test-project-path")
+ expect(Gitlab::ImportExport).to receive(:import_upload_path).with(filename: /\A[0-9a-f]{32}_test_project_export\.tar\.gz\z/).and_call_original
attach_file('file', file)