Skip to content

Commit 20247e2

Browse files
committed
Merge pull request tenderlove#14 from homakov/patch-1
sanitize after auto_link - tenderlove#13 XSS vulnerability
2 parents a9cd403 + be5ad89 commit 20247e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/rails_autolink/helpers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ def auto_link(text, *args, &block)#link = :all, html = {}, &block)
6060
options.reverse_merge!(:link => :all, :html => {})
6161
sanitize = (options[:sanitize] != false)
6262
sanitize_options = options[:sanitize_options] || {}
63-
text = conditional_sanitize(text, sanitize, sanitize_options).to_str
64-
case options[:link].to_sym
63+
text = case options[:link].to_sym
6564
when :all then conditional_html_safe(auto_link_email_addresses(auto_link_urls(text, options[:html], options, &block), options[:html], &block), sanitize)
6665
when :email_addresses then conditional_html_safe(auto_link_email_addresses(text, options[:html], &block), sanitize)
6766
when :urls then conditional_html_safe(auto_link_urls(text, options[:html], options, &block), sanitize)
6867
end
68+
conditional_sanitize(text, sanitize, sanitize_options).to_str
6969
end
7070

7171
private

0 commit comments

Comments
 (0)