From 4b5fa08f66a0942360b5bf4647b4308fddbe00e2 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Fri, 22 Mar 2013 01:04:22 +0000 Subject: [PATCH] Merged r11671, r11672 and r11674 from trunk to 2.3-stable (#13405) Fixed commit link title escaping. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.3-stable@11678 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 2 +- test/fixtures/changesets.yml | 3 ++- test/unit/helpers/application_helper_test.rb | 19 ++++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5670b2462..e277196b5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -758,7 +758,7 @@ module ApplicationHelper if repository && (changeset = Changeset.visible.where("repository_id = ? AND scmid LIKE ?", repository.id, "#{name}%").first) link = link_to h("#{project_prefix}#{repo_prefix}#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :repository_id => repository.identifier_param, :rev => changeset.identifier}, :class => 'changeset', - :title => truncate_single_line(h(changeset.comments), :length => 100) + :title => truncate_single_line(changeset.comments, :length => 100) end else if repository && User.current.allowed_to?(:browse_repository, project) diff --git a/test/fixtures/changesets.yml b/test/fixtures/changesets.yml index 08f8c79c8..247dda375 100644 --- a/test/fixtures/changesets.yml +++ b/test/fixtures/changesets.yml @@ -3,8 +3,9 @@ changesets_001: commit_date: 2007-04-11 committed_on: 2007-04-11 15:14:44 +02:00 revision: 1 + scmid: 691322a8eb01e11fd7 id: 100 - comments: My very first commit + comments: 'My very first commit do not escaping #<>&' repository_id: 10 committer: dlopper user_id: 3 diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 17219cf2a..a344669b4 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -264,11 +264,15 @@ RAW note_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3, :anchor => 'note-14'}, :class => Issue.find(3).css_classes, :title => 'Error 281 when updating a recipe (New)') - changeset_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, - :class => 'changeset', :title => 'My very first commit') - changeset_link2 = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2}, + revision_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, + :class => 'changeset', :title => 'My very first commit do not escaping #<>&') + revision_link2 = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2}, :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3') + changeset_link2 = link_to('691322a8eb01e11fd7', + {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, + :class => 'changeset', :title => 'My very first commit do not escaping #<>&') + document_link = link_to('Test document', {:controller => 'documents', :action => 'show', :id => 1}, :class => 'document') @@ -304,10 +308,11 @@ RAW # should not ignore leading zero '#03' => '#03', # changesets - 'r1' => changeset_link, - 'r1.' => "#{changeset_link}.", - 'r1, r2' => "#{changeset_link}, #{changeset_link2}", - 'r1,r2' => "#{changeset_link},#{changeset_link2}", + 'r1' => revision_link, + 'r1.' => "#{revision_link}.", + 'r1, r2' => "#{revision_link}, #{revision_link2}", + 'r1,r2' => "#{revision_link},#{revision_link2}", + 'commit:691322a8eb01e11fd7' => changeset_link2, # documents 'document#1' => document_link, 'document:"Test document"' => document_link, -- 2.39.5