diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-08-24 16:02:56 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-08-24 16:02:56 +0800 |
commit | e65bc0f175c54d9df66fd4950972c0b0b08d448e (patch) | |
tree | 402d04d4b124490d431344e9895b6dc3153727f9 /app/controllers | |
parent | bc3493f9474d2557c1c30bf30a61e4cd51ece0f1 (diff) | |
download | gitlab-ce-e65bc0f175c54d9df66fd4950972c0b0b08d448e.tar.gz |
Path could also have slashes! Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5142#note_14347729
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/artifacts_controller.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb index 60e432d68d8..17c6d56c8b9 100644 --- a/app/controllers/projects/artifacts_controller.rb +++ b/app/controllers/projects/artifacts_controller.rb @@ -1,4 +1,6 @@ class Projects::ArtifactsController < Projects::ApplicationController + include ExtractsPath + layout 'project' before_action :authorize_read_build! before_action :authorize_update_build!, only: [:keep] @@ -35,7 +37,8 @@ class Projects::ArtifactsController < Projects::ApplicationController end def latest_succeeded - target_path = artifacts_action_path(params[:path], project, build) + path = ref_name_and_path.last + target_path = artifacts_action_path(path, project, build) if target_path redirect_to(target_path) @@ -59,13 +62,18 @@ class Projects::ArtifactsController < Projects::ApplicationController end def build_from_ref - if params[:ref_name] - builds = project.latest_successful_builds_for(params[:ref_name]) + if params[:ref_name_and_path] + ref_name = ref_name_and_path.first + builds = project.latest_successful_builds_for(ref_name) builds.find_by(name: params[:job]) end end + def ref_name_and_path + @ref_name_and_path ||= extract_ref(params[:ref_name_and_path]) + end + def artifacts_file @artifacts_file ||= build.artifacts_file end |