Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read all part content use ReadPartErrorPolicy. #284

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

ly020044
Copy link
Contributor

@ly020044 ly020044 commented Mar 7, 2023

Hi,

The ReadPartErrorPolicy only used by content type text/*, Wouldn't it be better to use ReadPartErrorPolicy to control known errors when reading all part content?

For example, if the content type is image/*, a base64.CorruptInputError occurs while reading part content. This image may also be displayed if this error is ignored.

@iredmail
Copy link
Contributor

iredmail commented Mar 7, 2023

This PR can be used to fix errors like [E] Malformed Base64: illegal base64 data at input byte 0.

We already processed many emails with this error, the cause is base64 encoded attachment (e.g. image) is incomplete.

If we open this email with MUA like Thunderbird or macOS Mail.app, email body is fine, but the image is partly rendered (we can still view part of the image).

With this PR, we can define a policy like existing AllowCorruptTextPartErrorPolicy (but for all content types) to ignore base64 corrupt input, then successfully parse the email and get the incomplete image (which is expected).

@iredmail
Copy link
Contributor

iredmail commented Mar 9, 2023

hi @jhillyerd,

Could you help review this PR and hopefully merge it?

@jhillyerd jhillyerd merged commit 87c0655 into jhillyerd:master Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants