]> source.dussan.org Git - redmine.git/commitdiff
Small fix to the Redmine links regexp.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 17 Mar 2008 18:01:26 +0000 (18:01 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 17 Mar 2008 18:01:26 +0000 (18:01 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1268 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
test/unit/helpers/application_helper_test.rb

index 4e2a104457be11be2df0a18a32573d1b6bab2c65..f3b16bb260a8eec3be8c5f3c5dd490e2e76b97ae 100644 (file)
@@ -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?
index f34a587a294abc2a97ad087e0f42c35fdecb15d6..0a63c811e184db7633c993ee07189d3d362e62cc 100644 (file)
@@ -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) }