From 1d1aef9d61beec2504b2efedce99c8a8b7869835 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 4 Jul 2012 19:17:43 +0000 Subject: [PATCH] Fixed: unified diff link broken on specific file/revision diff (#11325). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9909 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- config/routes.rb | 2 ++ test/integration/routing/repositories_test.rb | 28 ++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index e79d0226f..1ecaba8af 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -226,6 +226,7 @@ RedmineApp::Application.routes.draw do get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', :controller => 'repositories', + :format => false, :constraints => { :action => /(browse|show|entry|raw|annotate|diff)/, :rev => /[a-z0-9\.\-_]+/ @@ -244,6 +245,7 @@ RedmineApp::Application.routes.draw do delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', :controller => 'repositories', + :format => false, :constraints => { :action => /(browse|show|entry|raw|annotate|diff)/, :rev => /[a-z0-9\.\-_]+/ diff --git a/test/integration/routing/repositories_test.rb b/test/integration/routing/repositories_test.rb index 2351721bb..fc4b54c6c 100644 --- a/test/integration/routing/repositories_test.rb +++ b/test/integration/routing/repositories_test.rb @@ -140,9 +140,11 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest ) assert_routing( { :method => 'get', - :path => "/projects/redmine/repository/revisions/2457/diff.diff" }, + :path => "/projects/redmine/repository/revisions/2457/diff" }, { :controller => 'repositories', :action => 'diff', :id => 'redmine', - :rev => '2457', :format => 'diff' } + :rev => '2457', :format => 'diff' }, + {}, + { :format => 'diff' } ) assert_routing( { :method => 'get', @@ -150,6 +152,14 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest { :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => @path_hash[:param], :rev => '2' } ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" }, + { :controller => 'repositories', :action => 'diff', :id => 'redmine', + :path => @path_hash[:param], :rev => '2', :format => 'diff' }, + {}, + { :format => 'diff' } + ) assert_routing( { :method => 'get', :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" }, @@ -209,9 +219,11 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest ) assert_routing( { :method => 'get', - :path => "/projects/redmine/repository/foo/revisions/2457/diff.diff" }, + :path => "/projects/redmine/repository/foo/revisions/2457/diff" }, { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', - :rev => '2457', :format => 'diff' } + :rev => '2457', :format => 'diff' }, + {}, + { :format => 'diff' } ) assert_routing( { :method => 'get', @@ -219,6 +231,14 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', :path => @path_hash[:param], :rev => '2' } ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" }, + { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', + :path => @path_hash[:param], :rev => '2', :format => 'diff' }, + {}, + { :format => 'diff' } + ) assert_routing( { :method => 'get', :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" }, -- 2.39.5