Use URL helper, feedback:

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5142#note_13880889
This commit is contained in:
Lin Jen-Shin 2016-08-16 01:03:08 +08:00
parent abf1cffff8
commit 73bbaffbfc
1 changed files with 7 additions and 3 deletions

View File

@ -35,10 +35,14 @@ class Projects::ArtifactsController < Projects::ApplicationController
end
def search
if params[:path]
url = namespace_project_build_url(project.namespace, project, build)
path = params[:path]
redirect_to "#{url}/artifacts/#{params[:path]}"
if %w[download browse file].include?(path)
redirect_to send(
"#{path}_namespace_project_build_artifacts_url",
project.namespace,
project,
build)
else
render_404
end