]> source.dussan.org Git - redmine.git/commitdiff
Fixed that www followed by a dot generates broken links in formatted text (#3676).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 24 Feb 2013 12:39:06 +0000 (12:39 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 24 Feb 2013 12:39:06 +0000 (12:39 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11473 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/wiki_formatting.rb
test/unit/helpers/application_helper_test.rb

index 312f6c48c5498e424c0f79f3973c829f39053320..2a3023a094c9d518899fd6304385d425c88143c1 100644 (file)
@@ -95,7 +95,7 @@ module Redmine
                         (?:www\.)                # www.*
                       )
                       (
-                        (\S+?)                   # url
+                        ([^<]\S*?)               # url
                         (\/)?                    # slash
                       )
                       ((?:&gt;)?|[^[:alnum:]_\=\/;\(\)]*?)               # post
index 6def2f40ca075b95fe74980dca705e491b9ece73..91323d3a55e9136875cbe2ee619b1e32acb1246a 100644 (file)
@@ -84,7 +84,10 @@ class ApplicationHelperTest < ActionView::TestCase
       # escaping
       'http://foo"bar' => '<a class="external" href="http://foo&quot;bar">http://foo&quot;bar</a>',
       # wrap in angle brackets
-      '<http://foo.bar>' => '&lt;<a class="external" href="http://foo.bar">http://foo.bar</a>&gt;'
+      '<http://foo.bar>' => '&lt;<a class="external" href="http://foo.bar">http://foo.bar</a>&gt;',
+      # invalid urls
+      'http://' => 'http://',
+      'www.' => 'www.',
     }
     to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
   end