2021-02-03 21:09:17 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-06-04 03:10:08 +00:00
|
|
|
# Repository routes without /-/ scope.
|
|
|
|
# Issue https://gitlab.com/gitlab-org/gitlab/-/issues/28848.
|
|
|
|
# Do not add new routes here. Add new routes to repository_scoped.rb instead
|
|
|
|
# (see https://docs.gitlab.com/ee/development/routing.html#project-routes).
|
2016-11-07 15:14:34 +00:00
|
|
|
|
2021-03-30 18:10:47 +00:00
|
|
|
resource :repository, only: [:create]
|
2016-11-07 15:14:34 +00:00
|
|
|
|
2017-04-13 16:44:52 +00:00
|
|
|
# Don't use format parameter as file extension (old 3.0.x behavior)
|
|
|
|
# See http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments
|
|
|
|
scope format: false do
|
2021-05-20 12:10:26 +00:00
|
|
|
get '/refs/switch',
|
|
|
|
to: redirect('%{namespace_id}/%{project_id}/-/refs/switch')
|
2017-04-13 16:44:52 +00:00
|
|
|
|
2021-05-20 12:10:26 +00:00
|
|
|
get '/refs/:id/logs_tree',
|
|
|
|
to: redirect('%{namespace_id}/%{project_id}/-/refs/%{id}/logs_tree'),
|
|
|
|
constraints: { id: Gitlab::PathRegex.git_reference_regex }
|
2017-04-13 16:44:52 +00:00
|
|
|
|
2021-05-20 12:10:26 +00:00
|
|
|
get '/refs/:id/logs_tree/*path',
|
|
|
|
to: redirect('%{namespace_id}/%{project_id}/-/refs/%{id}/logs_tree/%{path}'),
|
|
|
|
constraints: { id: /.*/, path: /[^\0]*/ }
|
2016-11-07 15:14:34 +00:00
|
|
|
|
2019-12-18 21:07:37 +00:00
|
|
|
scope constraints: { id: /[^\0]+/ } do
|
2021-05-20 12:10:26 +00:00
|
|
|
# Deprecated. Keep for compatibility.
|
|
|
|
# Issue https://gitlab.com/gitlab-org/gitlab/-/issues/118849
|
|
|
|
get '/tree/*id', to: 'tree#show', as: :deprecated_tree
|
|
|
|
get '/blob/*id', to: 'blob#show', as: :deprecated_blob
|
|
|
|
get '/raw/*id', to: 'raw#show', as: :deprecated_raw
|
|
|
|
get '/blame/*id', to: 'blame#show', as: :deprecated_blame
|
|
|
|
|
|
|
|
# Redirect those explicitly since `redirect_legacy_paths` conflicts with project new/edit actions
|
|
|
|
get '/new/*id', to: redirect('%{namespace_id}/%{project_id}/-/new/%{id}')
|
|
|
|
get '/edit/*id', to: redirect('%{namespace_id}/%{project_id}/-/edit/%{id}')
|
2017-04-13 16:44:52 +00:00
|
|
|
end
|
|
|
|
end
|