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
Boxiang Sun
gitlab-ce
Commits
c4496de8
Commit
c4496de8
authored
Jul 14, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide the file directly rather than redirecting
parent
70f508f5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
lib/api/builds.rb
lib/api/builds.rb
+2
-4
spec/requests/api/artifacts_spec.rb
spec/requests/api/artifacts_spec.rb
+8
-3
No files found.
lib/api/builds.rb
View file @
c4496de8
...
...
@@ -69,9 +69,8 @@ module API
authorize_read_builds!
build
=
get_build!
(
params
[
:build_id
])
artifacts_file
=
build
.
artifacts_file
present_artifact!
(
artifacts_file
)
present_artifact!
(
build
.
artifacts_file
)
end
# Download the artifacts file from ref_name and build_name
...
...
@@ -90,8 +89,7 @@ module API
latest_build
=
builds
.
success
.
latest
.
first
if
latest_build
redirect
(
"/projects/
#{
user_project
.
id
}
/builds/
#{
latest_build
.
id
}
/artifacts"
)
present_artifact!
(
latest_build
.
artifacts_file
)
else
not_found!
end
...
...
spec/requests/api/artifacts_spec.rb
View file @
c4496de8
...
...
@@ -31,10 +31,15 @@ describe API::API, api: true do
it_behaves_like
'artifacts from ref with 404'
end
context
'
302
'
do
context
'
200
'
do
def
verify
expect
(
response
).
to
redirect_to
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/artifacts"
)
download_headers
=
{
'Content-Transfer-Encoding'
=>
'binary'
,
'Content-Disposition'
=>
"attachment; filename=
#{
build
.
artifacts_file
.
filename
}
"
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
.
headers
).
to
include
(
download_headers
)
end
it_behaves_like
'artifacts from ref with 302'
...
...
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