summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-08-24 16:02:56 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-08-24 16:02:56 +0800
commite65bc0f175c54d9df66fd4950972c0b0b08d448e (patch)
tree402d04d4b124490d431344e9895b6dc3153727f9 /app
parentbc3493f9474d2557c1c30bf30a61e4cd51ece0f1 (diff)
downloadgitlab-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')
-rw-r--r--app/controllers/projects/artifacts_controller.rb14
-rw-r--r--app/helpers/gitlab_routing_helper.rb5
2 files changed, 14 insertions, 5 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
diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb
index cd526f17b99..a322a90cc4e 100644
--- a/app/helpers/gitlab_routing_helper.rb
+++ b/app/helpers/gitlab_routing_helper.rb
@@ -153,9 +153,10 @@ module GitlabRoutingHelper
# Artifacts
def artifacts_action_path(path, project, build)
- args = [project.namespace, project, build]
+ action, path_params = path.split('/', 2)
+ args = [project.namespace, project, build, path_params]
- case path
+ case action
when 'download'
download_namespace_project_build_artifacts_path(*args)
when 'browse'