Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-25 21:07:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-25 21:07:46 +0300
commit319dea10f06e32d119c0d46b8ec7b898b92a53a3 (patch)
tree77d8e0070cfa2ad9f1a8e6be0b852b5758a502a0 /app/helpers/gitlab_routing_helper.rb
parentcdd95ddd0197b8709947c2b3b4e0333e1d9a2934 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/gitlab_routing_helper.rb')
-rw-r--r--app/helpers/gitlab_routing_helper.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb
index 78c41257404..1fb0b83b010 100644
--- a/app/helpers/gitlab_routing_helper.rb
+++ b/app/helpers/gitlab_routing_helper.rb
@@ -153,6 +153,29 @@ module GitlabRoutingHelper
# Artifacts
+ # Rails path generators are slow because they need to do large regex comparisons
+ # against the arguments. We can speed this up 10x by generating the strings directly.
+
+ # /*namespace_id/:project_id/-/jobs/:job_id/artifacts/download(.:format)
+ def fast_download_project_job_artifacts_path(project, job)
+ expose_fast_artifacts_path(project, job, :download)
+ end
+
+ # /*namespace_id/:project_id/-/jobs/:job_id/artifacts/keep(.:format)
+ def fast_keep_project_job_artifacts_path(project, job)
+ expose_fast_artifacts_path(project, job, :keep)
+ end
+
+ # /*namespace_id/:project_id/-/jobs/:job_id/artifacts/browse(/*path)
+ def fast_browse_project_job_artifacts_path(project, job)
+ expose_fast_artifacts_path(project, job, :browse)
+ end
+
+ def expose_fast_artifacts_path(project, job, action)
+ path = "#{project.full_path}/-/jobs/#{job.id}/artifacts/#{action}"
+ Gitlab::Utils.append_path(Gitlab.config.gitlab.relative_url_root, path)
+ end
+
def artifacts_action_path(path, project, build)
action, path_params = path.split('/', 2)
args = [project, build, path_params]