-
Notifications
You must be signed in to change notification settings - Fork 102
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
add new option SetCustomParseMediaType to customise mediatype parsing #308
add new option SetCustomParseMediaType to customise mediatype parsing #308
Conversation
options_test.go
Outdated
return ParseMediaType(modifiedStr) | ||
} | ||
|
||
invalidMessageContent := `Return-path: <enmime.one@parser.git> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that this is inline content for the example function, but I think we should remove any unnecessary headers from the message to keep it compact and readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it's a bit unclear from contribution file, would it be feasible to keep commits for fixing proposals as separate commits, or do a rebase after review, so PR will still one commit?
part.go
Outdated
return ParseMediaType(ctype) | ||
} | ||
|
||
if p.parser.customParseMediaType == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be combined with if statement above.
I always squash PR merges via the GitHub button so you don't need to squash/rebase yourself. |
7fefdfe
to
9ebf13f
Compare
Looks good now, but I think we have some merge conflicts after I merged the previous PR |
Co-authored-by: James Hillyerd <james@hillyerd.com>
9ebf13f
to
2b14009
Compare
did rebase, should be no conflicts now |
Thanks! |
Problem
we've encountered real mail bodies where
Content-Type
is set to"application/Pamir Viewer; name=\"some-thing.pmrv\""
, which is not RFC compliant, but is still valuable for us to process it, so it can't be skipped usingSkipMalformedParts
Proposed solution
New option
SetCustomParseMediaType
which accepts function which has signature exactly the same asParseMediaType
. This option can be utilized in similar scenarios, see provided example:ExampleSetCustomParseMediaType
will allow to fix this #293 indirectly