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
iv
gitlab-ce
Commits
c5994711
Commit
c5994711
authored
Jun 10, 2016
by
Kamil Trzcinski
Committed by
Phil Hughes
Jun 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate existence of artifacts in ArtifactsController, render 404 if not found
parent
86800bf5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
app/controllers/projects/artifacts_controller.rb
app/controllers/projects/artifacts_controller.rb
+5
-6
No files found.
app/controllers/projects/artifacts_controller.rb
View file @
c5994711
class
Projects::ArtifactsController
<
Projects
::
ApplicationController
layout
'project'
before_action
:authorize_read_build!
before_action
:validate_artifacts!
def
download
unless
artifacts_file
.
file_storage?
return
redirect_to
artifacts_file
.
url
end
unless
artifacts_file
.
exists?
return
render_404
end
send_file
artifacts_file
.
path
,
disposition:
'attachment'
end
def
browse
return
render_404
unless
build
.
artifacts?
directory
=
params
[
:path
]
?
"
#{
params
[
:path
]
}
/"
:
''
@entry
=
build
.
artifacts_metadata_entry
(
directory
)
...
...
@@ -41,6 +36,10 @@ class Projects::ArtifactsController < Projects::ApplicationController
private
def
validate_artifacts!
render_404
unless
build
.
artifacts?
end
def
build
@build
||=
project
.
builds
.
find_by!
(
id:
params
[
:build_id
])
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