From 07f517d441ab8782286b4a59d56a630393d75e16 Mon Sep 17 00:00:00 2001 From: James Ramsay Date: Mon, 19 Feb 2018 15:41:04 -0500 Subject: Add new repository archive route Repository archives are always named `--` even if the ref is a commit. A consequence of always including the sha even for tags is that packaging a release is more difficult because both the ref and sha must be known by the packager. - add `/-/archive//.` route using the `-` separator to prevent namespace collisions. If the filename is `-` or the ref is a sha, the sha will be omitted, otherwise the default filename will be used. - deprecate previous archive route `repository//archive` --- config/routes/project.rb | 2 ++ config/routes/repository.rb | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'config') diff --git a/config/routes/project.rb b/config/routes/project.rb index 48ba8ef06f9..aa071d28f97 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -249,6 +249,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end scope '-' do + get 'archive/*id', constraints: { format: Gitlab::PathRegex.archive_formats_regex, id: /.+?/ }, to: 'repositories#archive', as: 'archive' + resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do collection do post :cancel_all diff --git a/config/routes/repository.rb b/config/routes/repository.rb index eace3a615b4..9e506a1a43a 100644 --- a/config/routes/repository.rb +++ b/config/routes/repository.rb @@ -2,10 +2,11 @@ resource :repository, only: [:create] do member do - get ':ref/archive', constraints: { format: Gitlab::PathRegex.archive_formats_regex, ref: /.+/ }, action: 'archive', as: 'archive' - # deprecated since GitLab 9.5 - get 'archive', constraints: { format: Gitlab::PathRegex.archive_formats_regex }, as: 'archive_alternative' + get 'archive', constraints: { format: Gitlab::PathRegex.archive_formats_regex }, as: 'archive_alternative', defaults: { append_sha: true } + + # deprecated since GitLab 10.7 + get ':id/archive', constraints: { format: Gitlab::PathRegex.archive_formats_regex, id: /.+/ }, action: 'archive', as: 'archive_deprecated', defaults: { append_sha: true } end end -- cgit v1.2.3