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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e2599356
Commit
e2599356
authored
Jan 16, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
f7265d5f
87f6f6f7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
4 deletions
+18
-4
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+7
-1
changelogs/unreleased/fix-403-page-is-rendered-but-404-is-the-response.yml
...ased/fix-403-page-is-rendered-but-404-is-the-response.yml
+5
-0
spec/controllers/application_controller_spec.rb
spec/controllers/application_controller_spec.rb
+2
-0
spec/features/projects/pipelines/pipeline_spec.rb
spec/features/projects/pipelines/pipeline_spec.rb
+4
-3
No files found.
app/controllers/application_controller.rb
View file @
e2599356
...
...
@@ -177,11 +177,17 @@ class ApplicationController < ActionController::Base
# hide existence of the resource, rather tell them they cannot access it using
# the provided message
status
||=
message
.
present?
?
:forbidden
:
:not_found
template
=
if
status
==
:not_found
"errors/not_found"
else
"errors/access_denied"
end
respond_to
do
|
format
|
format
.
any
{
head
status
}
format
.
html
do
render
"errors/access_denied"
,
render
template
,
layout:
"errors"
,
status:
status
,
locals:
{
message:
message
}
...
...
changelogs/unreleased/fix-403-page-is-rendered-but-404-is-the-response.yml
0 → 100644
View file @
e2599356
---
title
:
Show the correct error page when access is denied
merge_request
:
23932
author
:
type
:
fixed
spec/controllers/application_controller_spec.rb
View file @
e2599356
...
...
@@ -519,12 +519,14 @@ describe ApplicationController do
get
:index
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
render_template
(
'errors/not_found'
)
end
it
'renders a 403 when a message is passed to access denied'
do
get
:index
,
params:
{
message:
'None shall pass'
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
render_template
(
'errors/access_denied'
)
end
it
'renders a status passed to access denied'
do
...
...
spec/features/projects/pipelines/pipeline_spec.rb
View file @
e2599356
...
...
@@ -477,10 +477,11 @@ describe 'Pipeline', :js do
end
context
'when accessing failed jobs page'
do
it
'
fails to access the
page'
do
subject
it
'
renders a 404
page'
do
requests
=
inspect_requests
{
subject
}
expect
(
page
).
to
have_title
(
'Access Denied'
)
expect
(
page
).
to
have_title
(
'Not Found'
)
expect
(
requests
.
first
.
status_code
).
to
eq
(
404
)
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