diff options
Diffstat (limited to 'config/routes/project.rb')
-rw-r--r-- | config/routes/project.rb | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/config/routes/project.rb b/config/routes/project.rb index d02dc974434..24b44646d95 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -25,7 +25,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do # Use this scope for all new project routes. scope '-' do get 'archive/*id', constraints: { format: Gitlab::PathRegex.archive_formats_regex, id: /.+?/ }, to: 'repositories#archive', as: 'archive' - get 'metrics(/:dashboard_path)(/:page)', constraints: { dashboard_path: /.+\.yml/, page: 'panel/new' }, + # Since the page parameter can contain slashes (panel/new), use Rails' + # "Route Globbing" syntax (/*page) so that the route helpers do not encode + # the slash character. + get 'metrics(/:dashboard_path)(/*page)', constraints: { dashboard_path: /.+\.yml/, page: 'panel/new' }, to: 'metrics_dashboard#show', as: :metrics_dashboard, format: false namespace :metrics, module: :metrics do @@ -367,6 +370,19 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do post :mark_as_spam end end + + resources :feature_flags, param: :iid do + resources :feature_flag_issues, only: [:index, :create, :destroy], as: 'issues', path: 'issues' + end + resource :feature_flags_client, only: [] do + post :reset_token + end + resources :feature_flags_user_lists, param: :iid, only: [:new, :edit, :show] + + get '/schema/:branch/*filename', + to: 'web_ide_schemas#show', + format: false, + as: :schema end # End of the /-/ scope. @@ -564,3 +580,37 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do # rubocop: enable Cop/PutProjectRoutesUnderScope end end + +# It's under /-/jira scope but cop is only checking /-/ +# rubocop: disable Cop/PutProjectRoutesUnderScope +scope path: '(/-/jira)', constraints: ::Constraints::JiraEncodedUrlConstrainer.new, as: :jira do + scope path: '*namespace_id/:project_id', + namespace_id: Gitlab::Jira::Dvcs::ENCODED_ROUTE_REGEX, + project_id: Gitlab::Jira::Dvcs::ENCODED_ROUTE_REGEX do + get '/', to: redirect { |params, req| + ::Gitlab::Jira::Dvcs.restore_full_path( + namespace: params[:namespace_id], + project: params[:project_id] + ) + } + + get 'commit/:id', constraints: { id: /\h{7,40}/ }, to: redirect { |params, req| + project_full_path = ::Gitlab::Jira::Dvcs.restore_full_path( + namespace: params[:namespace_id], + project: params[:project_id] + ) + + "/#{project_full_path}/commit/#{params[:id]}" + } + + get 'tree/*id', as: nil, to: redirect { |params, req| + project_full_path = ::Gitlab::Jira::Dvcs.restore_full_path( + namespace: params[:namespace_id], + project: params[:project_id] + ) + + "/#{project_full_path}/-/tree/#{params[:id]}" + } + end +end +# rubocop: enable Cop/PutProjectRoutesUnderScope |