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
Léo-Paul Géneau
gitlab-ce
Commits
3b874414
Commit
3b874414
authored
Sep 05, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not use artifacts metadata to access single artifact
parent
52e52f4a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
16 deletions
+11
-16
app/controllers/projects/artifacts_controller.rb
app/controllers/projects/artifacts_controller.rb
+7
-5
lib/api/jobs.rb
lib/api/jobs.rb
+4
-3
spec/requests/api/jobs_spec.rb
spec/requests/api/jobs_spec.rb
+0
-8
No files found.
app/controllers/projects/artifacts_controller.rb
View file @
3b874414
...
...
@@ -7,7 +7,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
before_action
:authorize_update_build!
,
only:
[
:keep
]
before_action
:extract_ref_name_and_path
before_action
:validate_artifacts!
before_action
:
set_path_and_entry
,
only:
[
:file
,
:raw
]
before_action
:
entry
,
only:
[
:file
]
def
download
if
artifacts_file
.
file_storage?
...
...
@@ -41,7 +41,10 @@ class Projects::ArtifactsController < Projects::ApplicationController
end
def
raw
send_artifacts_entry
(
build
,
@entry
)
path
=
Gitlab
::
Ci
::
Build
::
Artifacts
::
Path
.
new
(
params
[
:path
])
send_artifacts_entry
(
build
,
path
)
end
def
keep
...
...
@@ -93,9 +96,8 @@ class Projects::ArtifactsController < Projects::ApplicationController
@artifacts_file
||=
build
.
artifacts_file
end
def
set_path_and_entry
@path
=
params
[
:path
]
@entry
=
build
.
artifacts_metadata_entry
(
@path
)
def
entry
@entry
=
build
.
artifacts_metadata_entry
(
params
[
:path
])
render_404
unless
@entry
.
exists?
end
...
...
lib/api/jobs.rb
View file @
3b874414
...
...
@@ -98,10 +98,11 @@ module API
build
=
get_build!
(
params
[
:job_id
])
not_found!
unless
build
.
artifacts?
entry
=
build
.
artifacts_metadata_entry
(
params
[
:artifact_path
])
not_found!
unless
entry
.
exists?
path
=
Gitlab
::
Ci
::
Build
::
Artifacts
::
Path
.
new
(
params
[
:artifact_path
])
not_found!
unless
path
.
valid?
send_artifacts_entry
(
build
,
entry
)
send_artifacts_entry
(
build
,
path
)
end
desc
'Download the artifacts file from a job'
do
...
...
spec/requests/api/jobs_spec.rb
View file @
3b874414
...
...
@@ -220,14 +220,6 @@ describe API::Jobs do
'Gitlab-Workhorse-Send-Data'
=>
/artifacts-entry/
)
end
end
context
'when request path is invalid'
do
it
'does not find artifact file'
do
get_artifact_file
(
'invalid/path'
)
expect
(
response
).
to
have_http_status
(
404
)
end
end
end
context
'when job does not have artifacts'
do
...
...
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