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
Kazuhiko Shiozaki
gitlab-ce
Commits
167a6b9e
Commit
167a6b9e
authored
Apr 06, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render a 404 when RefsController#logs_tree gets an HTML request
Fixes #2152
parent
0d0042d2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
app/controllers/projects/refs_controller.rb
app/controllers/projects/refs_controller.rb
+5
-0
spec/controllers/projects/refs_controller_spec.rb
spec/controllers/projects/refs_controller_spec.rb
+41
-0
No files found.
app/controllers/projects/refs_controller.rb
View file @
167a6b9e
...
@@ -55,5 +55,10 @@ class Projects::RefsController < Projects::ApplicationController
...
@@ -55,5 +55,10 @@ class Projects::RefsController < Projects::ApplicationController
commit:
last_commit
commit:
last_commit
}
}
end
end
respond_to
do
|
format
|
format
.
html
{
render_404
}
format
.
js
end
end
end
end
end
spec/controllers/projects/refs_controller_spec.rb
0 → 100644
View file @
167a6b9e
require
'spec_helper'
describe
Projects
::
RefsController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
end
describe
'GET #logs_tree'
do
def
default_get
(
format
=
:html
)
get
:logs_tree
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
'master'
,
path:
'foo/bar/baz.html'
,
format:
format
end
def
xhr_get
(
format
=
:html
)
xhr
:get
,
:logs_tree
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
'master'
,
path:
'foo/bar/baz.html'
,
format:
format
end
it
'never throws MissingTemplate'
do
expect
{
default_get
}.
not_to
raise_error
expect
{
xhr_get
}.
not_to
raise_error
end
it
'renders 404 for non-JS requests'
do
xhr_get
expect
(
response
).
to
be_not_found
end
it
'renders JS'
do
xhr_get
(
:js
)
expect
(
response
).
to
be_success
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