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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
0611c5c6
Commit
0611c5c6
authored
Jun 03, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deploy key api 500 if key is empty
parent
50e8d6c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
lib/api/projects.rb
lib/api/projects.rb
+16
-14
No files found.
lib/api/projects.rb
View file @
0611c5c6
...
...
@@ -428,21 +428,23 @@ module API
post
":id/keys"
do
attrs
=
attributes_for_keys
[
:title
,
:key
]
attrs
[
:key
].
strip!
# check if key already exist in project
key
=
user_project
.
deploy_keys
.
find_by_key
(
attrs
[
:key
])
if
key
present
key
,
with:
Entities
::
SSHKey
return
end
if
attrs
[
:key
].
present?
attrs
[
:key
].
strip!
# check if key already exist in project
key
=
user_project
.
deploy_keys
.
find_by_key
(
attrs
[
:key
])
if
key
present
key
,
with:
Entities
::
SSHKey
return
end
# Check for available deploy keys in other projects
key
=
current_user
.
owned_deploy_keys
.
find_by_key
(
attrs
[
:key
])
if
key
user_project
.
deploy_keys
<<
key
present
key
,
with:
Entities
::
SSHKey
return
# Check for available deploy keys in other projects
key
=
current_user
.
owned_deploy_keys
.
find_by_key
(
attrs
[
:key
])
if
key
user_project
.
deploy_keys
<<
key
present
key
,
with:
Entities
::
SSHKey
return
end
end
key
=
DeployKey
.
new
attrs
...
...
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