diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-03-17 18:01:26 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-03-17 18:01:26 +0000 |
commit | 030afe74281672852836f6688093a9a988a60e72 (patch) | |
tree | 9e923a4fed3c611beafd307eeaaad944f6f21638 | |
parent | 93d1b2e0a43982f37b60f6b15b36bc46e3c79f9b (diff) | |
download | redmine-030afe74281672852836f6688093a9a988a60e72.tar.gz redmine-030afe74281672852836f6688093a9a988a60e72.zip |
Small fix to the Redmine links regexp.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1268 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/helpers/application_helper.rb | 2 | ||||
-rw-r--r-- | test/unit/helpers/application_helper_test.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4e2a10445..f3b16bb26 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -287,7 +287,7 @@ module ApplicationHelper # source:some/file#L120 -> Link to line 120 of the file # source:some/file@52#L120 -> Link to line 120 of the file's revision 52 # export:some/file -> Force the download of the file - text = text.gsub(%r{([\s\(,-^])(!)?(attachment|document|version|commit|source|export)?((#|r)(\d+)|(:)([^"][^\s<>]+|"[^"]+"))(?=[[:punct:]]|\s|<|$)}) do |m| + text = text.gsub(%r{([\s\(,-^])(!)?(attachment|document|version|commit|source|export)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*|"[^"]+"))(?=[[:punct:]]|\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 f34a587a2..0a63c811e 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -105,6 +105,8 @@ class ApplicationHelperTest < HelperTestCase '!version:1.0' => 'version:1.0', '!version:"1.0"' => 'version:"1.0"', '!source:/some/file' => 'source:/some/file', + # invalid expressions + 'source:' => 'source:' } @project = Project.find(1) to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |