summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
authorNihad Abbasov <narkoz.2008@gmail.com>2012-07-25 05:24:28 -0700
committerNihad Abbasov <narkoz.2008@gmail.com>2012-07-25 05:24:28 -0700
commitcb32e0320ab538b465574bb73c7bd3d32db56d3c (patch)
tree6136c187606044a9590567f8c94de17ac9b3b369 /lib/api/helpers.rb
parentf7dd067490fe57505f7226c3b54d3127d2f7fd46 (diff)
downloadgitlab-ce-cb32e0320ab538b465574bb73c7bd3d32db56d3c.tar.gz
return 404 if project not found
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 4dfe35f49ef..c1ea05667ae 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -5,8 +5,13 @@ module Gitlab
end
def user_project
- @project ||= current_user.projects.find_by_id(params[:id]) ||
- current_user.projects.find_by_code(params[:id])
+ if @project ||= current_user.projects.find_by_id(params[:id]) ||
+ current_user.projects.find_by_code(params[:id])
+ else
+ error!({'message' => '404 Not found'}, 404)
+ end
+
+ @project
end
def authenticate!