2021-02-03 16:09:17 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-06-03 23:10:08 -04:00
|
|
|
# Repository routes without /-/ scope.
|
|
|
|
# Issue https://gitlab.com/gitlab-org/gitlab/-/issues/28848.
|
2021-06-08 05:09:56 -04:00
|
|
|
# Do not add new routes here. Add new routes to repository.rb instead
|
2021-06-03 23:10:08 -04:00
|
|
|
# (see https://docs.gitlab.com/ee/development/routing.html#project-routes).
|
2016-11-07 10:14:34 -05:00
|
|
|
|
2021-03-30 14:10:47 -04:00
|
|
|
resource :repository, only: [:create]
|
2016-11-07 10:14:34 -05:00
|
|
|
|
2017-04-13 12:44:52 -04: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 08:10:26 -04:00
|
|
|
get '/refs/switch',
|
|
|
|
to: redirect('%{namespace_id}/%{project_id}/-/refs/switch')
|
2017-04-13 12:44:52 -04:00
|
|
|
|
2021-05-20 08:10:26 -04: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 12:44:52 -04:00
|
|
|
|
2021-05-20 08:10:26 -04: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 10:14:34 -05:00
|
|
|
|
2019-12-18 16:07:37 -05:00
|
|
|
scope constraints: { id: /[^\0]+/ } do
|
2021-05-20 08:10:26 -04: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 12:44:52 -04:00
|
|
|
end
|
|
|
|
end
|