FEATURE: Censor Oneboxes (#12902)

Previously onebox content was not passed by the censor regex, meaning you could sneak in censored words via onebox.
This commit is contained in:
Bianca Nenciu
2021-06-03 04:39:12 +03:00
committed by GitHub
parent 58cb120aa2
commit d184fe59ca
3 changed files with 49 additions and 1 deletions

View File

@ -455,7 +455,10 @@ module Oneboxer
onebox_options[:user_agent] = user_agent_override if user_agent_override
r = Onebox.preview(uri.to_s, onebox_options)
result = { onebox: r.to_s, preview: r&.placeholder_html.to_s }
result = {
onebox: WordWatcher.censor(r.to_s),
preview: WordWatcher.censor(r&.placeholder_html.to_s)
}
# NOTE: Call r.errors after calling placeholder_html
if r.errors.any?