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
This commit is contained in:
Jean-Philippe Lang 2012-07-04 19:17:43 +00:00
parent d00ba6d2bb
commit 1d1aef9d61
2 changed files with 26 additions and 4 deletions

View File

@ -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', :to => 'repositories#revisions'
get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))',
:controller => 'repositories', :controller => 'repositories',
:format => false,
:constraints => { :constraints => {
:action => /(browse|show|entry|raw|annotate|diff)/, :action => /(browse|show|entry|raw|annotate|diff)/,
:rev => /[a-z0-9\.\-_]+/ :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' delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))',
:controller => 'repositories', :controller => 'repositories',
:format => false,
:constraints => { :constraints => {
:action => /(browse|show|entry|raw|annotate|diff)/, :action => /(browse|show|entry|raw|annotate|diff)/,
:rev => /[a-z0-9\.\-_]+/ :rev => /[a-z0-9\.\-_]+/

View File

@ -140,9 +140,11 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest
) )
assert_routing( assert_routing(
{ :method => 'get', { :method => 'get',
:path => "/projects/redmine/repository/revisions/2457/diff.diff" }, :path => "/projects/redmine/repository/revisions/2457/diff" },
{ :controller => 'repositories', :action => 'diff', :id => 'redmine', { :controller => 'repositories', :action => 'diff', :id => 'redmine',
:rev => '2457', :format => 'diff' } :rev => '2457', :format => 'diff' },
{},
{ :format => 'diff' }
) )
assert_routing( assert_routing(
{ :method => 'get', { :method => 'get',
@ -150,6 +152,14 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest
{ :controller => 'repositories', :action => 'diff', :id => 'redmine', { :controller => 'repositories', :action => 'diff', :id => 'redmine',
:path => @path_hash[:param], :rev => '2' } :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( assert_routing(
{ :method => 'get', { :method => 'get',
:path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" }, :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" },
@ -209,9 +219,11 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest
) )
assert_routing( assert_routing(
{ :method => 'get', { :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', { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
:rev => '2457', :format => 'diff' } :rev => '2457', :format => 'diff' },
{},
{ :format => 'diff' }
) )
assert_routing( assert_routing(
{ :method => 'get', { :method => 'get',
@ -219,6 +231,14 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest
{ :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
:path => @path_hash[:param], :rev => '2' } :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( assert_routing(
{ :method => 'get', { :method => 'get',
:path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" }, :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" },