Raise an exception when handling unsafe content
We were confused about what `.html_safe` did, and were automatically marking as safe content which was not.
This commit is contained in:
@@ -8,8 +8,8 @@ module TextWithLinksHelper
|
||||
|
||||
def auto_link_already_sanitized_html(html)
|
||||
return if html.nil?
|
||||
html = ActiveSupport::SafeBuffer.new(html) if html.is_a?(String)
|
||||
return html.html_safe unless html.html_safe?
|
||||
raise "Could not add links because the content is not safe" unless html.html_safe?
|
||||
|
||||
Rinku.auto_link(html, :all, 'target="_blank" rel="nofollow"').html_safe
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user