summaryrefslogtreecommitdiff
path: root/lib/gitlab/email/html_parser.rb
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-06-22 15:05:52 +0200
committerPawel Chojnacki <pawel@chojnacki.ws>2017-06-22 15:05:52 +0200
commit97c42df3b804a37e659c3cda6bd8a52570f31366 (patch)
tree97c38db7f71a93a7b0db5ca2c682d6d17479cbdb /lib/gitlab/email/html_parser.rb
parent3833f1dd84dfec844443a5b1d9ba2bd2b911c0bc (diff)
parent11716f310dcc495600f5a17e08456a1abb296482 (diff)
downloadgitlab-ce-97c42df3b804a37e659c3cda6bd8a52570f31366.tar.gz
Merge remote-tracking branch 'upstream/master' into 28717-additional-metrics-review-branch28717-additional-metrics-review-branch
Diffstat (limited to 'lib/gitlab/email/html_parser.rb')
-rw-r--r--lib/gitlab/email/html_parser.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/email/html_parser.rb b/lib/gitlab/email/html_parser.rb
index a4ca62bfc41..50559a48973 100644
--- a/lib/gitlab/email/html_parser.rb
+++ b/lib/gitlab/email/html_parser.rb
@@ -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