From dd23e07111ae3190f0abd557ef470be51d5d0acf Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Fri, 27 Apr 2012 16:17:03 +0000 Subject: [PATCH] route: add constraints to repositories which are lost in Rails3 route git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9546 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- config/routes.rb | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index d2f1cc22c..ed26767e3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -220,8 +220,18 @@ RedmineApp::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/:format(/*path(.:ext))', :to => 'repositories#entry', :format => /raw/ - get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', :controller => 'repositories', :action => /(browse|show|entry|changes|annotate|diff)/ + get 'projects/:id/repository/:repository_id/revisions/:rev/:format(/*path(.:ext))', + :to => 'repositories#entry', + :constraints => { + :format => 'raw', + :rev => /[a-z0-9\.\-_]+/ + } + get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', + :controller => 'repositories', + :constraints => { + :action => /(browse|show|entry|changes|annotate|diff)/, + :rev => /[a-z0-9\.\-_]+/ + } get 'projects/:id/repository/statistics', :to => 'repositories#stats' get 'projects/:id/repository/graph', :to => 'repositories#graph' @@ -232,8 +242,18 @@ RedmineApp::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/:format(/*path(.:ext))', :to => 'repositories#entry', :format => /raw/ - get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', :controller => 'repositories', :action => /(browse|show|entry|changes|annotate|diff)/ + get 'projects/:id/repository/revisions/:rev/:format(/*path(.:ext))', + :to => 'repositories#entry', + :constraints => { + :format => 'raw', + :rev => /[a-z0-9\.\-_]+/ + } + get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', + :controller => 'repositories', + :constraints => { + :action => /(browse|show|entry|changes|annotate|diff)/, + :rev => /[a-z0-9\.\-_]+/ + } get 'projects/:id/repository/:repository_id/:format(/*path(.:ext))', :to => 'repositories#entry', :format => /raw/ get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', :controller => 'repositories', :action => /(browse|show|entry|changes|annotate|diff)/ get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil -- 2.39.5