summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-06-20 17:14:37 +0000
committerDouwe Maan <douwe@gitlab.com>2017-06-20 17:14:37 +0000
commitaf5c7c76ff857e88ebfb74267f3ab6cb910d4155 (patch)
tree012c3abe5de91de53a321891ea0388e7b3876cf1 /lib
parent026455cf3af1ca7fee0279f3bed645361dac4b1f (diff)
parentb869a99a743f02873038aeeb07d7b5ffbf4f6d89 (diff)
downloadgitlab-ce-af5c7c76ff857e88ebfb74267f3ab6cb910d4155.tar.gz
Merge branch 'bugfix/html-email-brackets' into 'master'
unwrap links without an href Closes #27645 See merge request !9045
Diffstat (limited to 'lib')
-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