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
Tatuya Kamada
gitlab-ce
Commits
f5ab126f
Commit
f5ab126f
authored
Feb 15, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure Commit#show responds 404 instead of 500 when given an invalid ID
Closes #13467
parent
c29517aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+2
-2
spec/controllers/projects/commit_controller_spec.rb
spec/controllers/projects/commit_controller_spec.rb
+37
-0
No files found.
app/controllers/projects/commit_controller.rb
View file @
f5ab126f
...
...
@@ -11,8 +11,6 @@ class Projects::CommitController < Projects::ApplicationController
before_action
:define_show_vars
,
only:
[
:show
,
:builds
]
def
show
return
git_not_found!
unless
@commit
apply_diff_view_cookie!
@line_notes
=
commit
.
notes
.
inline
...
...
@@ -68,6 +66,8 @@ class Projects::CommitController < Projects::ApplicationController
end
def
define_show_vars
return
git_not_found!
unless
commit
if
params
[
:w
].
to_i
==
1
@diffs
=
commit
.
diffs
({
ignore_whitespace_change:
true
})
else
...
...
spec/controllers/projects/commit_controller_spec.rb
0 → 100644
View file @
f5ab126f
require
'rails_helper'
describe
Projects
::
CommitController
do
describe
'GET show'
do
let
(
:project
)
{
create
(
:project
)
}
before
do
user
=
create
(
:user
)
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
end
context
'with valid id'
do
it
'responds with 200'
do
go
id:
project
.
commit
.
id
expect
(
response
).
to
be_ok
end
end
context
'with invalid id'
do
it
'responds with 404'
do
go
id:
project
.
commit
.
id
.
reverse
expect
(
response
).
to
be_not_found
end
end
def
go
(
id
:)
get
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
id
end
end
end
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