diff --git a/lib/redcloth3.rb b/lib/redcloth3.rb index ee934b6ab..0d6ca324c 100644 --- a/lib/redcloth3.rb +++ b/lib/redcloth3.rb @@ -816,10 +816,10 @@ class RedCloth3 < String ": ( # $url (\/|[a-zA-Z]+:\/\/|www\.|mailto:) # $proto - [\w\/]\S+? + [[:alnum:]_\/]\S+? ) (\/)? # $slash - ([^\w\=\/;\(\)]*?) # $post + ([^[:alnum:]_\=\/;\(\)]*?) # $post ) (?=<|\s|$) /x diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index 800200e14..5691b1acb 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.rb @@ -98,7 +98,7 @@ module Redmine (\S+?) # url (\/)? # slash ) - ((?:>)?|[^\w\=\/;\(\)]*?) # post + ((?:>)?|[^[:alnum:]_\=\/;\(\)]*?) # post (?=<|\s|$) }x unless const_defined?(:AUTO_LINK_RE) diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 6d5021ed5..d44dba8a2 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -88,6 +88,17 @@ class ApplicationHelperTest < ActionView::TestCase to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } end + if 'ruby'.respond_to?(:encoding) + def test_auto_links_with_non_ascii_characters + to_test = { + 'http://foo.bar/тест' => 'http://foo.bar/тест' + } + to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } + end + else + puts 'Skipping test_auto_links_with_non_ascii_characters, unsupported ruby version' + end + def test_auto_mailto assert_equal '

test@foo.bar

', textilizable('test@foo.bar') @@ -228,6 +239,17 @@ RAW to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } end + if 'ruby'.respond_to?(:encoding) + def test_textile_external_links_with_non_ascii_characters + to_test = { + 'This is a "link":http://foo.bar/тест' => 'This is a link' + } + to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } + end + else + puts 'Skipping test_textile_external_links_with_non_ascii_characters, unsupported ruby version' + end + def test_redmine_links issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3}, :class => 'issue status-1 priority-4 priority-lowest overdue', :title => 'Error 281 when updating a recipe (New)')