adds text_with_links helper and use that in any comment.body in views, adds test to check for malicious injections in comment body
This commit is contained in:
9
app/helpers/text_with_links_helper.rb
Normal file
9
app/helpers/text_with_links_helper.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
module TextWithLinksHelper
|
||||
|
||||
def text_with_links(text)
|
||||
return unless text
|
||||
sanitized = sanitize text, tags: %w(a), attributes: %w(href)
|
||||
Rinku.auto_link(sanitized, :all, 'target="_blank" rel="nofollow"').html_safe
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user