Skip to content

Commit

Permalink
roll back and whitelist protocols
Browse files Browse the repository at this point in the history
Repairing auto_link workflow
Closes tenderlove#15 tenderlove#16
  • Loading branch information
homakov committed May 26, 2012
1 parent b9825e2 commit 2c98ff6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/rails_autolink/helpers.rb
Expand Up @@ -60,18 +60,18 @@ def auto_link(text, *args, &block)#link = :all, html = {}, &block)
options.reverse_merge!(:link => :all, :html => {})
sanitize = (options[:sanitize] != false)
sanitize_options = options[:sanitize_options] || {}
text = case options[:link].to_sym
text = conditional_sanitize(text, sanitize, sanitize_options).to_str
case options[:link].to_sym
when :all then conditional_html_safe(auto_link_email_addresses(auto_link_urls(text, options[:html], options, &block), options[:html], &block), sanitize)
when :email_addresses then conditional_html_safe(auto_link_email_addresses(text, options[:html], &block), sanitize)
when :urls then conditional_html_safe(auto_link_urls(text, options[:html], options, &block), sanitize)
end
conditional_sanitize(text, sanitize, sanitize_options).to_str
end

private

AUTO_LINK_RE = %r{
(?: ([0-9A-Za-z+.:-]+:)// | www\. )
(?: ((?:ed2k|ftp|http|https|irc|mailto|news|gopher|nntp|telnet|webcal|xmpp|callto|feed|svn|urn|aim|rsync|tag|ssh|sftp|rtsp|afs):)// | www\. )
[^\s<]+
}x

Expand Down

0 comments on commit 2c98ff6

Please sign in to comment.