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
442a49db
Commit
442a49db
authored
Feb 05, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip authentication when requesting commit status badge
parent
28c4c949
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+7
-1
config/routes.rb
config/routes.rb
+1
-1
No files found.
app/controllers/projects/commit_controller.rb
View file @
442a49db
...
...
@@ -10,6 +10,11 @@ class Projects::CommitController < Projects::ApplicationController
before_action
:commit
before_action
:define_show_vars
,
only:
[
:show
,
:builds
]
# Skip authentication for status badge only
skip_before_action
:authenticate_user!
,
:reject_blocked!
,
:project
,
:repository
,
:require_non_empty_project
,
:authorize_download_code!
,
:commit
,
only:
[
:badge
]
def
show
return
git_not_found!
unless
@commit
...
...
@@ -58,7 +63,8 @@ class Projects::CommitController < Projects::ApplicationController
end
def
badge
image
=
Ci
::
ImageForBuildService
.
new
.
execute
(
@project
,
ref:
params
[
:id
])
project
=
Project
.
find_with_namespace
(
"
#{
params
[
:namespace_id
]
}
/
#{
params
[
:project_id
]
}
"
)
image
=
Ci
::
ImageForBuildService
.
new
.
execute
(
project
,
ref:
params
[
:id
])
send_file
(
image
.
path
,
filename:
image
.
name
,
disposition:
'inline'
,
type:
'image/svg+xml'
)
end
...
...
config/routes.rb
View file @
442a49db
...
...
@@ -498,7 +498,7 @@ Rails.application.routes.draw do
'/status/*id/badge'
,
to:
'commit#badge'
,
constraints:
{
format:
/png/
},
as: :
commit
_badge
as: :
build
_badge
)
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