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
Jérome Perrin
gitlab-ce
Commits
cb32e032
Commit
cb32e032
authored
Jul 25, 2012
by
Nihad Abbasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return 404 if project not found
parent
f7dd0674
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
lib/api/helpers.rb
lib/api/helpers.rb
+7
-2
spec/api/projects_spec.rb
spec/api/projects_spec.rb
+6
-0
No files found.
lib/api/helpers.rb
View file @
cb32e032
...
...
@@ -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!
...
...
spec/api/projects_spec.rb
View file @
cb32e032
...
...
@@ -36,6 +36,12 @@ describe Gitlab::API do
response
.
status
.
should
==
200
json_response
[
'name'
].
should
==
project
.
name
end
it
"should return a 404 error if not found"
do
get
"
#{
api_prefix
}
/projects/42?private_token=
#{
user
.
private_token
}
"
response
.
status
.
should
==
404
json_response
[
'message'
].
should
==
'404 Not found'
end
end
describe
"GET /projects/:id/repository/branches"
do
...
...
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