summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-02-12 14:46:47 +0100
committerJames Lopez <james@jameslopez.es>2018-02-13 15:25:48 +0100
commitd3b3f5d1b4def5e87f90a2347acc0b0ee8edc80a (patch)
tree08d1914f9e8b9e411cb6dcd8c416bc0bcda0a252 /lib/api
parent82ff66ef31d6ff8ba2332f51b38f79b3bd7d64a5 (diff)
downloadgitlab-ce-d3b3f5d1b4def5e87f90a2347acc0b0ee8edc80a.tar.gz
update import API and spec
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/project_import.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/api/project_import.rb b/lib/api/project_import.rb
index 4bbb78a62f9..396c316af22 100644
--- a/lib/api/project_import.rb
+++ b/lib/api/project_import.rb
@@ -17,6 +17,7 @@ module API
end
params do
+ requires :name, type: String, desc: 'The new project name'
optional :namespace, type: String, desc: 'The ID or name of the namespace that the project will be imported into. Defaults to the user namespace.'
requires :file, type: File, desc: 'The project export file to be imported'
end
@@ -37,9 +38,11 @@ module API
Namespace.find_by_path_or_name(namespace)
end
- project = ::Projects::GitlabProjectsImportService.new(current_user, import_params).execute
+ project_params = import_params.merge(namespace: namespace.id)
- render_api_error!(link.project.full_messages.first, 400) unless project.saved?
+ project = ::Projects::GitlabProjectsImportService.new(current_user, project_params).execute
+
+ render_api_error!(project.full_messages.first, 400) unless project.saved?
present project, with: Entities::ProjectImportStatus
end