-
- Downloads
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. `<table>` - 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
Showing
- Gemfile 1 addition, 0 deletionsGemfile
- Gemfile.lock 3 additions, 0 deletionsGemfile.lock
- changelogs/unreleased/bugfix-html-only-mail.yml 4 additions, 0 deletionschangelogs/unreleased/bugfix-html-only-mail.yml
- lib/gitlab/email/html_parser.rb 34 additions, 0 deletionslib/gitlab/email/html_parser.rb
- lib/gitlab/email/reply_parser.rb 13 additions, 6 deletionslib/gitlab/email/reply_parser.rb
- spec/fixtures/emails/outlook_html.eml 140 additions, 0 deletionsspec/fixtures/emails/outlook_html.eml
- spec/lib/gitlab/email/reply_parser_spec.rb 4 additions, 0 deletionsspec/lib/gitlab/email/reply_parser_spec.rb
Loading
Please register or sign in to comment