Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7ec1a022
Commit
7ec1a022
authored
Feb 12, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix file upload
parent
516d33f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
lib/api/project_import.rb
lib/api/project_import.rb
+4
-3
spec/requests/api/project_import_spec.rb
spec/requests/api/project_import_spec.rb
+2
-2
No files found.
lib/api/project_import.rb
View file @
7ec1a022
...
...
@@ -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 refnam
e is invalid'
,
400
)
unless
file_is_valid?
render_api_error!
(
'The
fil
e 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
...
...
spec/requests/api/project_import_spec.rb
View file @
7ec1a022
...
...
@@ -19,9 +19,9 @@ describe API::ProjectImport do
it
'schedules an import'
do
expect_any_instance_of
(
Project
).
to
receive
(
:import_schedule
)
post
api
(
'/projects/import'
,
user
),
path:
'test-import'
,
file:
fi
le
,
namespace:
namespace
.
full_path
post
api
(
'/projects/import'
,
user
),
path:
'test-import'
,
file:
fi
xture_file_upload
(
file
)
,
namespace:
namespace
.
full_path
expect
(
response
).
to
have_gitlab_http_status
(
20
0
)
expect
(
response
).
to
have_gitlab_http_status
(
20
1
)
expect
(
Project
.
find_by_name
(
'test-import'
).
first
.
status
).
to
eq
(
'started'
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment