summaryrefslogtreecommitdiff
path: root/lib/api/keys.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 00:08:14 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 00:08:14 +0000
commit427c549b6396885fb60a687326b6cd62878e4ca3 (patch)
tree145713e2f6fdaf7499b0cb44010503e16b6248b9 /lib/api/keys.rb
parent74a89b1221eaf780374bd1d4c5b2ee4a0f488908 (diff)
downloadgitlab-ce-427c549b6396885fb60a687326b6cd62878e4ca3.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/keys.rb')
-rw-r--r--lib/api/keys.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/api/keys.rb b/lib/api/keys.rb
index 8f837107192..bec3dc9bd97 100644
--- a/lib/api/keys.rb
+++ b/lib/api/keys.rb
@@ -26,12 +26,15 @@ module API
get do
authenticated_with_can_read_all_resources!
- finder_params = params.merge(key_type: 'ssh')
-
- key = KeysFinder.new(current_user, finder_params).execute
+ key = KeysFinder.new(current_user, params).execute
not_found!('Key') unless key
- present key, with: Entities::SSHKeyWithUser, current_user: current_user
+
+ if key.type == "DeployKey"
+ present key, with: Entities::DeployKeyWithUser, current_user: current_user
+ else
+ present key, with: Entities::SSHKeyWithUser, current_user: current_user
+ end
rescue KeysFinder::InvalidFingerprint
render_api_error!('Failed to return the key', 400)
end