-
Notifications
You must be signed in to change notification settings - Fork 260
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
Fix!: The ability to get Content-Type value from attachments (Inbound Parse) #416
base: main
Are you sure you want to change the base?
Conversation
Thank you for the PR! Could you please update your branch with the latest updates from |
helpers/inbound/inbound.go
Outdated
headers := make(map[string]string) | ||
content := readBody(emailPart) | ||
|
||
headers["Content-Type"] = emailPart.Header.Get("Content-Type") |
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.
Why not just headers := emailPart.Header
(would need to change type). Alternatively, instead of storing headers, make ContentType
one of the properties of ParsedAttachment
, and do some simple string parsing to extract the MIME type from the string returned by emailPart.Header.Get("Content-Type")
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've changed the ParsedAttachment.Headers to type MIMEHeader and stored the full attachment headers in there. Also added a string ContentType to take the content type (Without the name="***" part). Updated the tests for this too.
…d parsed all attachment headers in the Headers property
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.
LGTM! Thank you for the contribution!
Fixes #412
Previously we could not infer the content type of an attachment from it's contents (see #412) . I've updated the ParsedEmail Attachments property to be of (new) type ParsedAttachment. This new struct has it's "Content-Type" header populated on email parse and included tests.
Checklist
If you have questions, please file a support ticket, or create a GitHub Issue in this repository.