summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/project_import.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/api/project_import.rb b/lib/api/project_import.rb
index 1b63f4d4d9f..5a4e4189a58 100644
--- a/lib/api/project_import.rb
+++ b/lib/api/project_import.rb
@@ -8,7 +8,7 @@ module API
end
def file_is_valid?
- import_params[:file] && import_params[:file].respond_to?(:read)
+ import_params[:file] && import_params[:file]['tempfile'].respond_to?(:read)
end
end
@@ -26,7 +26,7 @@ module API
success Entities::ProjectImportStatus
end
post 'import' do
- render_api_error!('The branch refname is invalid', 400) unless file_is_valid?
+ render_api_error!('The file is invalid', 400) unless file_is_valid?
namespace = import_params[:namespace]
@@ -38,7 +38,8 @@ module API
Namespace.find_by_path_or_name(namespace)
end
- project_params = import_params.merge(namespace_id: namespace.id)
+ project_params = import_params.merge(namespace_id: namespace.id,
+ file: import_params[:file]['tempfile'])
project = ::Projects::GitlabProjectsImportService.new(current_user, project_params).execute