summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-12-01 16:55:33 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-12-01 16:55:33 +0200
commit612b8806ddc7881421e26a9dbfe465d6445fb3d6 (patch)
tree18a918b7cdf7dcc8ce7d4cdc7cd42ac39c57a5e1 /lib
parent06b7907c2afe0cb0fa25f4cdef0ff470710de2f9 (diff)
downloadgitlab-ce-612b8806ddc7881421e26a9dbfe465d6445fb3d6.tar.gz
Fix internal API for missing project or key
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/api/internal.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 1648834f034..180e50611cf 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -33,15 +33,20 @@ module API
end
project = Project.find_with_namespace(project_path)
- return false unless project
+
+ unless project
+ return Gitlab::GitAccessStatus.new(false, 'No such project')
+ end
actor = if params[:key_id]
- Key.find(params[:key_id])
+ Key.find_by(id: params[:key_id])
elsif params[:user_id]
- User.find(params[:user_id])
+ User.find_by(id: params[:user_id])
end
- return false unless actor
+ unless actor
+ return Gitlab::GitAccessStatus.new(false, 'No such user or key')
+ end
access.check(
actor,