Skip to content

Commit

Permalink
auto_link: avoid recognizing full width chars as a part of URI scheme
Browse files Browse the repository at this point in the history
fixes regression by http://github.com/rails/rails/commit/133ada6ab0f0cb7bef2bd40dbc18f2d5bc6b964e

[#5503 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information
amatsuda authored and spastorino committed Feb 1, 2011
1 parent 8a85f64 commit cb9fa52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/helpers/text_helper.rb
Expand Up @@ -459,7 +459,7 @@ def set_cycle(name, cycle_object)
end

AUTO_LINK_RE = %r{
(?: ([\w+.:-]+:)// | www\. )
(?: ([0-9A-Za-z+.:-]+:)// | www\. )
[^\s<]+
}x

Expand Down
8 changes: 7 additions & 1 deletion actionpack/test/template/text_helper_test.rb
@@ -1,4 +1,4 @@
# encoding: us-ascii
# encoding: utf-8
require 'abstract_unit'
require 'testing_sandbox'

Expand Down Expand Up @@ -415,6 +415,12 @@ def test_auto_link
link10_raw = 'http://www.mail-archive.com/ruby-talk@ruby-lang.org/'
link10_result = generate_result(link10_raw)
assert_equal %(<p>#{link10_result} Link</p>), auto_link("<p>#{link10_raw} Link</p>")

link11_raw = 'http://asakusa.rubyist.net/'
link11_result = generate_result(link11_raw)
with_kcode 'u' do
assert_equal %(浅草.rbの公式サイトはこちら#{link11_result}), auto_link("浅草.rbの公式サイトはこちら#{link11_raw}")
end
end

def test_auto_link_should_sanitize_input_when_sanitize_option_is_not_false
Expand Down

0 comments on commit cb9fa52

Please sign in to comment.