diff --git a/lib/email_cook.rb b/lib/email_cook.rb index bc1f587944d..f440be6389c 100644 --- a/lib/email_cook.rb +++ b/lib/email_cook.rb @@ -20,7 +20,16 @@ class EmailCook def link_string!(str) str.scan(EmailCook.url_regexp).each do |m| url = m[0] - str.gsub!(url, "#{url}") + + val = "#{url}" + + # Onebox consideration + if str.strip == url + oneboxed = Oneboxer.onebox(url) + val = oneboxed if oneboxed.present? + end + + str.gsub!(url, val) end end