diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-07-04 12:48:25 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-07-04 12:48:25 +0000 |
commit | da22a9c8d653fb969bf10bdd7e0746d603a752b4 (patch) | |
tree | 342b0e5e62b593ed5a75043685f4f09502e3af88 | |
parent | 5afa190a9ab93f7a7b40da4e1fd6be7633dab9ce (diff) | |
download | redmine-da22a9c8d653fb969bf10bdd7e0746d603a752b4.tar.gz redmine-da22a9c8d653fb969bf10bdd7e0746d603a752b4.zip |
Do not require a non-word character after a comma in Redmine links (#3561).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2804 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/helpers/application_helper.rb | 2 | ||||
-rw-r--r-- | test/unit/helpers/application_helper_test.rb | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fd070de3a..573d49c45 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -441,7 +441,7 @@ module ApplicationHelper # export:some/file -> Force the download of the file # Forum messages: # message#1218 -> Link to message with id 1218 - text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|\s|<|$)}) do |m| + text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|<|$)}) do |m| leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8 link = nil if esc.nil? diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 21ed10ae5..4d7719567 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -124,6 +124,8 @@ class ApplicationHelperTest < HelperTestCase 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}, + :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3') document_link = link_to('Test document', {:controller => 'documents', :action => 'show', :id => 1}, :class => 'document') @@ -141,6 +143,9 @@ class ApplicationHelperTest < HelperTestCase '#3, #3 and #3.' => "#{issue_link}, #{issue_link} and #{issue_link}.", # changesets 'r1' => changeset_link, + 'r1.' => "#{changeset_link}.", + 'r1, r2' => "#{changeset_link}, #{changeset_link2}", + 'r1,r2' => "#{changeset_link},#{changeset_link2}", # documents 'document#1' => document_link, 'document:"Test document"' => document_link, |