From 1b9ca7219bf1906b134aae11d650d9698ea79cb6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 11 Jul 2016 17:27:32 +0000 Subject: [PATCH] Removes dynamic :action in routes. git-svn-id: http://svn.redmine.org/redmine/trunk@15634 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- config/routes.rb | 51 +++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 06b500120..1e49a9dd5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -246,13 +246,13 @@ Rails.application.routes.draw do post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' - get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path)', - :controller => 'repositories', - :format => false, - :constraints => { - :action => /(browse|show|entry|raw|annotate|diff)/, - :rev => /[a-z0-9\.\-_]+/ - } + %w(browse show entry raw annotate diff).each do |action| + get "projects/:id/repository/:repository_id/revisions/:rev/#{action}(/*path)", + :controller => 'repositories', + :action => action, + :format => false, + :constraints => {:rev => /[a-z0-9\.\-_]+/} + end get 'projects/:id/repository/statistics', :to => 'repositories#stats' get 'projects/:id/repository/graph', :to => 'repositories#graph' @@ -266,21 +266,28 @@ Rails.application.routes.draw do get 'projects/:id/repository/revision', :to => 'repositories#revision' post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' - get 'projects/:id/repository/revisions/:rev/:action(/*path)', - :controller => 'repositories', - :format => false, - :constraints => { - :action => /(browse|show|entry|raw|annotate|diff)/, - :rev => /[a-z0-9\.\-_]+/ - } - get 'projects/:id/repository/:repository_id/:action(/*path)', - :controller => 'repositories', - :action => /(browse|show|entry|raw|changes|annotate|diff)/, - :format => false - get 'projects/:id/repository/:action(/*path)', - :controller => 'repositories', - :action => /(browse|show|entry|raw|changes|annotate|diff)/, - :format => false + %w(browse show entry raw annotate diff).each do |action| + get "projects/:id/repository/revisions/:rev/#{action}(/*path)", + :controller => 'repositories', + :action => action, + :format => false, + :constraints => {:rev => /[a-z0-9\.\-_]+/} + end + %w(browse entry raw changes annotate diff).each do |action| + get "projects/:id/repository/:repository_id/#{action}(/*path)", + :controller => 'repositories', + :action => action, + :format => false + end + %w(browse entry raw changes annotate diff).each do |action| + get "projects/:id/repository/#{action}(/*path)", + :controller => 'repositories', + :action => action, + :format => false + end + + get 'projects/:id/repository/:repository_id/show/*path', :to => 'repositories#show', :format => false + get 'projects/:id/repository/show/*path', :to => 'repositories#show', :format => false get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil get 'projects/:id/repository', :to => 'repositories#show', :path => nil -- 2.39.5