Repository navigation
Add MHTML (.mhtml/.mht) converter - #2676
Open
Bicheng (Kenneth) (BichengWang) wants to merge 1 commit into
Open
Bicheng (Kenneth) (BichengWang) wants to merge 1 commit into
Bicheng (Kenneth) (BichengWang) wants to merge 1 commit into
Conversation
Pull the page's HTML part out of the MIME container with the stdlib email parser and convert it with HtmlConverter. Handles quoted-printable/base64 bodies, declared charsets, XHTML roots and the multipart/related start parameter. Embedded resources are ignored. Closes microsoft#228
Author
|
Hello members, is there any one can help additional review? Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #228.
MHTML files currently fall through to the plain-text converter, so the output is the raw MIME container (headers, boundaries, base64 images).
This adds
MhtmlConverter. It parses the container with the stdlibemailpackage, picks the page's HTML part, and hands it toHtmlConverter. No new dependencies.startparameter if there is one, otherwise the first HTML part (text/htmlorapplication/xhtml+xml).Subjectas the title when the page has no<title>.cid:image references stay as they are in the HTML..mhtml,.mht, and theapplication/x-mimearchivetype Magika reports, so extensionless files work too.message/rfc822, so.emlhandling is not affected.Tests are in
tests/test_mhtml.py. The full suite passes locally.