Commit cc91f09a authored by Lin Jen-Shin's avatar Lin Jen-Shin

Just use find_by! and we're rescuing ActiveRecord::RecordNotFound

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5142#note_13125645
parent 6830e282
...@@ -84,13 +84,9 @@ module API ...@@ -84,13 +84,9 @@ module API
get ':id/builds/artifacts/:ref_name/download', get ':id/builds/artifacts/:ref_name/download',
requirements: { ref_name: /.+/ } do requirements: { ref_name: /.+/ } do
builds = user_project.latest_success_builds_for(params[:ref_name]) builds = user_project.latest_success_builds_for(params[:ref_name])
latest_build = builds.where(name: params[:job]).first latest_build = builds.find_by!(name: params[:job])
if latest_build
present_artifact!(latest_build.artifacts_file) present_artifact!(latest_build.artifacts_file)
else
not_found!
end
end end
# Get a trace of a specific build of a project # Get a trace of a specific build of a project
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment