Skip to content

Commit 5591c4a

Browse files
committed
makes protocols regex case insensitive
1 parent 33193b8 commit 5591c4a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/rails_autolink/helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def auto_link(text, *args, &block) #link = :all, html = {}, &block)
7373
AUTO_LINK_RE = %r{
7474
(?: ((?:ed2k|ftp|http|https|irc|mailto|news|gopher|nntp|telnet|webcal|xmpp|callto|feed|svn|urn|aim|rsync|tag|ssh|sftp|rtsp|afs|file):)// | www\. )
7575
[^\s<\u00A0]+
76-
}x
76+
}ix
7777

7878
# regexps for determining context, used high-volume
7979
AUTO_LINK_CRE = [/<[^>]+$/, /^[^>]*>/, /<a\b.*?>/i, /<\/a>/i]

test/test_rails_autolink.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ def test_auto_link_already_linked
138138
assert_equal linked_email, auto_link(linked_email)
139139
end
140140

141-
142141
def test_auto_link_at_eol
143142
url1 = "http://api.rubyonrails.com/Foo.html"
144143
url2 = "http://www.ruby-doc.org/core/Bar.html"
@@ -278,6 +277,9 @@ def test_auto_link
278277
link12_raw = 'http://tools.ietf.org/html/rfc3986'
279278
link12_result = generate_result(link12_raw)
280279
assert_equal %(<p>#{link12_result} text-after-nonbreaking-space</p>), auto_link("<p>#{link12_raw} text-after-nonbreaking-space</p>")
280+
281+
link13_raw = 'HTtP://www.rubyonrails.com'
282+
assert_equal generate_result(link13_raw), auto_link(link13_raw)
281283
end
282284

283285
def test_auto_link_parsing

0 commit comments

Comments
 (0)