Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-11-18 20:15:56 +0300
committerDouwe Maan <douwe@gitlab.com>2016-11-18 20:15:56 +0300
commit2717675fbc10c97904e6a3eebf498d2c53fe5ce5 (patch)
tree098245239581426ea1a1a917eed62bdb784905ff /spec/lib
parent88479f7f3071c2d79447896deeea63fb78b175df (diff)
parente1b868307169b562a595b5cb41bda7e8b984600f (diff)
Merge branch 'bugfix/html-only-mail' into 'master'
add parsing support for incoming html email ## What does this MR do? Fixes #18388 by adding support for parsing HTML email ## Are there points in the code the reviewer needs to double check? The new class, Gitlab::Email::HTMLParser, which needs to translate the HTML content to text and also delete replies, as they are not necessarily in the correct format to be caught by EmailReplyParser. The solution I found that should work for any HTML-formatted email is to remove all `<table>` and `<blockquote>` tags. Actual `<table>` elements (to be interpreted by markdown) should already be encoded with e.g. `&lt;table&gt;` - the only failure mode is if there is an *actual* HTML table in the content itself, which we wouldn't be able to support easily anyways. The gem `html2text` traverses the HTML tree and outputs text - and markdown in the case of HTML links or images. See merge request !7397
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/email/reply_parser_spec.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/lib/gitlab/email/reply_parser_spec.rb b/spec/lib/gitlab/email/reply_parser_spec.rb
index 6f8e9a4be64..c7a0139d32a 100644
--- a/spec/lib/gitlab/email/reply_parser_spec.rb
+++ b/spec/lib/gitlab/email/reply_parser_spec.rb
@@ -206,5 +206,9 @@ describe Gitlab::Email::ReplyParser, lib: true do
it "properly renders email reply from MS Outlook client" do
expect(test_parse_body(fixture_file("emails/outlook.eml"))).to eq("Microsoft Outlook 2010")
end
+
+ it "properly renders html-only email from MS Outlook" do
+ expect(test_parse_body(fixture_file("emails/outlook_html.eml"))).to eq("Microsoft Outlook 2010")
+ end
end
end