summaryrefslogtreecommitdiff
path: root/config/routes
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 11:59:07 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 11:59:07 +0000
commit8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch)
tree544930fb309b30317ae9797a9683768705d664c4 /config/routes
parent4b1de649d0168371549608993deac953eb692019 (diff)
downloadgitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'config/routes')
-rw-r--r--config/routes/admin.rb2
-rw-r--r--config/routes/git_http.rb105
-rw-r--r--config/routes/group.rb3
-rw-r--r--config/routes/import.rb9
-rw-r--r--config/routes/merge_requests.rb1
-rw-r--r--config/routes/repository_scoped.rb1
-rw-r--r--config/routes/user.rb7
7 files changed, 53 insertions, 75 deletions
diff --git a/config/routes/admin.rb b/config/routes/admin.rb
index 2db2caafcd8..71a927f59b9 100644
--- a/config/routes/admin.rb
+++ b/config/routes/admin.rb
@@ -18,6 +18,7 @@ namespace :admin do
put :unlock
put :confirm
put :approve
+ delete :reject
post :impersonate
patch :disable_two_factor
delete 'remove/:email_id', action: 'remove_email', as: 'remove_email'
@@ -126,6 +127,7 @@ namespace :admin do
resources :integrations, only: [:edit, :update] do
member do
put :test
+ post :reset
end
end
diff --git a/config/routes/git_http.rb b/config/routes/git_http.rb
index fb8119904ea..715d4b5cc59 100644
--- a/config/routes/git_http.rb
+++ b/config/routes/git_http.rb
@@ -1,60 +1,47 @@
-concern :gitactionable do
- scope(controller: :git_http) do
- get '/info/refs', action: :info_refs
- post '/git-upload-pack', action: :git_upload_pack
- post '/git-receive-pack', action: :git_receive_pack
- end
-end
-
-concern :lfsable do
- # Git LFS API (metadata)
- scope(path: 'info/lfs/objects', controller: :lfs_api) do
- post :batch
- post '/', action: :deprecated
- get '/*oid', action: :deprecated
- end
-
- scope(path: 'info/lfs') do
- resources :lfs_locks, controller: :lfs_locks_api, path: 'locks' do
- post :unlock, on: :member
- post :verify, on: :collection
- end
- end
-
- # GitLab LFS object storage
- scope(path: 'gitlab-lfs/objects/*oid', controller: :lfs_storage, constraints: { oid: /[a-f0-9]{64}/ }) do
- get '/', action: :download
-
- scope constraints: { size: /[0-9]+/ } do
- put '/*size/authorize', action: :upload_authorize
- put '/*size', action: :upload_finalize
- end
- end
-end
-
-# Git route for personal and project snippets
-scope(path: ':namespace_id/:repository_id',
- format: nil,
- constraints: { namespace_id: Gitlab::PathRegex.personal_and_project_snippets_path_regex, repository_id: /\d+\.git/ },
- module: :repositories) do
- concerns :gitactionable
-end
-
-scope(path: '*namespace_id/:repository_id',
- format: nil,
- constraints: { namespace_id: Gitlab::PathRegex.full_namespace_route_regex }) do
- scope(constraints: { repository_id: Gitlab::PathRegex.project_git_route_regex }) do
+scope(path: '*repository_path', format: false) do
+ constraints(repository_path: Gitlab::PathRegex.repository_git_route_regex) do
scope(module: :repositories) do
- concerns :gitactionable
- concerns :lfsable
+ # Git HTTP API
+ scope(controller: :git_http) do
+ get '/info/refs', action: :info_refs
+ post '/git-upload-pack', action: :git_upload_pack
+ post '/git-receive-pack', action: :git_receive_pack
+ end
+
+ # NOTE: LFS routes are exposed on all repository types, but we still check for
+ # LFS availability on the repository container in LfsRequest#lfs_check_access!
+
+ # Git LFS API (metadata)
+ scope(path: 'info/lfs/objects', controller: :lfs_api) do
+ post :batch
+ post '/', action: :deprecated
+ get '/*oid', action: :deprecated
+ end
+
+ scope(path: 'info/lfs') do
+ resources :lfs_locks, controller: :lfs_locks_api, path: 'locks' do
+ post :unlock, on: :member
+ post :verify, on: :collection
+ end
+ end
+
+ # GitLab LFS object storage
+ scope(path: 'gitlab-lfs/objects/*oid', controller: :lfs_storage, constraints: { oid: /[a-f0-9]{64}/ }) do
+ get '/', action: :download
+
+ constraints(size: /[0-9]+/) do
+ put '/*size/authorize', action: :upload_authorize
+ put '/*size', action: :upload_finalize
+ end
+ end
end
end
# Redirect /group/project.wiki.git to the project wiki
- scope(format: true, constraints: { repository_id: Gitlab::PathRegex.project_wiki_git_route_regex, format: :git }) do
+ constraints(repository_path: Gitlab::PathRegex.repository_wiki_git_route_regex) do
wiki_redirect = redirect do |params, request|
- project_id = params[:repository_id].delete_suffix('.wiki')
- path = [params[:namespace_id], project_id, 'wikis'].join('/')
+ container_path = params[:repository_path].delete_suffix('.wiki.git')
+ path = File.join(container_path, '-', 'wikis')
path << "?#{request.query_string}" unless request.query_string.blank?
path
end
@@ -63,22 +50,14 @@ scope(path: '*namespace_id/:repository_id',
end
# Redirect /group/project/info/refs to /group/project.git/info/refs
- scope(constraints: { repository_id: Gitlab::PathRegex.project_route_regex }) do
- # Allow /info/refs, /info/refs?service=git-upload-pack, and
- # /info/refs?service=git-receive-pack, but nothing else.
- #
- git_http_handshake = lambda do |request|
- ::Constraints::ProjectUrlConstrainer.new.matches?(request, existence_check: false) &&
- (request.query_string.blank? ||
- request.query_string.match(/\Aservice=git-(upload|receive)-pack\z/))
- end
-
+ # This allows cloning a repository without the trailing `.git`
+ constraints(repository_path: Gitlab::PathRegex.repository_route_regex) do
ref_redirect = redirect do |params, request|
- path = "#{params[:namespace_id]}/#{params[:repository_id]}.git/info/refs"
+ path = "#{params[:repository_path]}.git/info/refs"
path << "?#{request.query_string}" unless request.query_string.blank?
path
end
- get '/info/refs', constraints: git_http_handshake, to: ref_redirect
+ get '/info/refs', constraints: ::Constraints::RepositoryRedirectUrlConstrainer.new, to: ref_redirect
end
end
diff --git a/config/routes/group.rb b/config/routes/group.rb
index e90be482bbd..38c04369d2f 100644
--- a/config/routes/group.rb
+++ b/config/routes/group.rb
@@ -46,6 +46,7 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
resources :integrations, only: [:index, :edit, :update] do
member do
put :test
+ post :reset
end
end
end
@@ -124,7 +125,7 @@ end
# Dependency proxy for containers
# Because docker adds v2 prefix to URI this need to be outside of usual group routes
scope format: false do
- get 'v2', to: proc { [200, {}, ['']] } # rubocop:disable Cop/PutGroupRoutesUnderScope
+ get 'v2' => 'groups/dependency_proxy_auth#authenticate' # rubocop:disable Cop/PutGroupRoutesUnderScope
constraints image: Gitlab::PathRegex.container_image_regex, sha: Gitlab::PathRegex.container_image_blob_sha_regex do
get 'v2/*group_id/dependency_proxy/containers/*image/manifests/*tag' => 'groups/dependency_proxy_for_containers#manifest' # rubocop:todo Cop/PutGroupRoutesUnderScope
diff --git a/config/routes/import.rb b/config/routes/import.rb
index 557d7fe7143..6c99b0320de 100644
--- a/config/routes/import.rb
+++ b/config/routes/import.rb
@@ -42,15 +42,6 @@ namespace :import do
get :realtime_changes
end
- resource :google_code, only: [:create, :new], controller: :google_code do
- get :status
- post :callback
- get :jobs
-
- get :new_user_map, path: :user_map
- post :create_user_map, path: :user_map
- end
-
resource :fogbugz, only: [:create, :new], controller: :fogbugz do
get :status
post :callback
diff --git a/config/routes/merge_requests.rb b/config/routes/merge_requests.rb
index c11e5a5c3d9..41d831f239e 100644
--- a/config/routes/merge_requests.rb
+++ b/config/routes/merge_requests.rb
@@ -17,6 +17,7 @@ resources :merge_requests, concerns: :awardable, except: [:new, :create, :show],
get :accessibility_reports
get :coverage_reports
get :terraform_reports
+ get :codequality_reports
scope constraints: ->(req) { req.format == :json }, as: :json do
get :commits
diff --git a/config/routes/repository_scoped.rb b/config/routes/repository_scoped.rb
index 865a5bdb5a9..7fabf3ff895 100644
--- a/config/routes/repository_scoped.rb
+++ b/config/routes/repository_scoped.rb
@@ -34,6 +34,7 @@ scope format: false do
scope constraints: { id: /[^\0]+?/ } do
scope controller: :static_site_editor do
get '/sse/:id(/*vueroute)', action: :show, as: :show_sse
+ get '/sse', as: :root_sse, action: :index
end
end
end
diff --git a/config/routes/user.rb b/config/routes/user.rb
index 63329277e33..515a9a23360 100644
--- a/config/routes/user.rb
+++ b/config/routes/user.rb
@@ -54,8 +54,11 @@ scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) d
end
constraints(::Constraints::UserUrlConstrainer.new) do
- # Get all keys of user
- get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }
+ # Get all SSH keys of user
+ get ':username.keys' => 'users#ssh_keys', constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }
+
+ # Get all GPG keys of user
+ get ':username.gpg' => 'users#gpg_keys', constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }
scope(path: ':username',
as: :user,