unwrap all links with no href

This commit is contained in:
http://jneen.net/ 2017-02-06 10:22:31 -08:00
parent d866c7763c
commit ef39fb0b54

View file

@ -17,6 +17,13 @@ module Gitlab
def filter_replies!
document.xpath('//blockquote').each(&:remove)
document.xpath('//table').each(&:remove)
# bogus links with no href are sometimes added by outlook,
# and can result in Html2Text adding extra square brackets
# to the text, so we unwrap them here.
document.xpath('//a[not(@href)]').each do |link|
link.replace(link.children)
end
end
def filtered_html