From dfca67d844ca10498e1e4e4834117bc390696d46 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 24 Feb 2013 12:39:06 +0000 Subject: [PATCH] Fixed that www followed by a dot generates broken links in formatted text (#3676). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11473 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/wiki_formatting.rb | 2 +- test/unit/helpers/application_helper_test.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index 312f6c48c..2a3023a09 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.rb @@ -95,7 +95,7 @@ module Redmine (?:www\.) # www.* ) ( - (\S+?) # url + ([^<]\S*?) # url (\/)? # slash ) ((?:>)?|[^[:alnum:]_\=\/;\(\)]*?) # post diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 6def2f40c..91323d3a5 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -84,7 +84,10 @@ class ApplicationHelperTest < ActionView::TestCase # escaping 'http://foo"bar' => 'http://foo"bar', # wrap in angle brackets - '' => '<http://foo.bar>' + '' => '<http://foo.bar>', + # invalid urls + 'http://' => 'http://', + 'www.' => 'www.', } to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } end