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,