This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 23
Add the ability to store multipart/alternative messages #36
Closed
settermjd
wants to merge
10
commits into
laminas:2.13.x
from
settermjd:add-multipart-alternative-support
Closed
Add the ability to store multipart/alternative messages #36
settermjd
wants to merge
10
commits into
laminas:2.13.x
from
settermjd:add-multipart-alternative-support
Conversation
This file contains 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
This change adds the ability to properly parse messages where the content type is "multipart/alternative" into multiple Part objects. Previously, the "multipart/alternative" content-type header would be ignored, leaving alternative parts being rolled into one larger Part object. Signed-off-by: Matthew Setter <[email protected]>
This is a small change to correct some minor points in the related documentation. Signed-off-by: Matthew Setter <[email protected]>
weierophinney
suggested changes
Nov 23, 2023
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.
A couple minor change suggestions, but overall looks solid (though I might prefer we typehint the $parts
property as Part[]
).
Also... Run phpcbf and phpcs before your next push.
I wasn't aware at the time that I created the previous commit with the constant, of the existence of a constant with the same value. So this commit removes my duplicate constant, replacing it with the existing one. Signed-off-by: Matthew Setter <[email protected]>
Co-authored-by: Matthew Weier O'Phinney <[email protected]> Signed-off-by: Matthew Setter <[email protected]>
As per @MWOP's suggestion, this change properly typehints the protected $parts property in Part to return an array of Part objects. Signed-off-by: Matthew Setter <[email protected]>
Signed-off-by: Matthew Setter <[email protected]>
This change adds a series of assertions for attachments on multipart/alternative messages, to help verify that they contain what they're expected to contain. I felt that it was helpful to have assertions for attachments (or non text/HTML content) as well, so that more of the code could be properly tested. Signed-off-by: Matthew Setter <[email protected]>
These were originally used because it was a fairly generic email that I had at the time, while writing the tests. However, as per @MWOP's suggestion, it should be more generic (and not preference a given, commercial, email provider). Signed-off-by: Matthew Setter <[email protected]>
settermjd
force-pushed
the
add-multipart-alternative-support
branch
from
November 23, 2023 23:12
9372edc
to
f67b0c0
Compare
All changes made and checks pass, except for Autocloser. |
This change simplistically sets a Part's filename property if the content disposition header is set, it's an attachment, and the filename property is set. I've deliberately avoided any considerations about sanitising the filename, deciding, at this stage, to leave that to the calling code up the line. Signed-off-by: Matthew Setter <[email protected]>
settermjd
force-pushed
the
add-multipart-alternative-support
branch
from
November 29, 2023 06:47
4224580
to
93c2cd6
Compare
Previously, the code only set a filename for a message part if the part contained a content-disposition header where the disposition type was set to "attachment" and the filename parameter was set. After re-reading https://www.w3.org/Protocols/HTTP/Issues/content-disposition.txt, I see that this was wrong, as the content-disposition header can have the filename parameter set if the type is attachment or inline. This commit corrects that earlier mistake. Signed-off-by: Matthew Setter <[email protected]>
This library is being abandoned: https://github.com/laminas/technical-steering-committee/blob/main/meetings/minutes/2023-12-04-TSC-Minutes.md |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
This change adds the ability to properly parse messages where the parent message's content-type is set to
multipart/alternative
into multiple Part objects. Previously, this content-type header would be ignored, leaving alternative parts being rolled into one single Part object. See 7.2.3 The Multipart/alternative subtype for more information.At the moment, I don't know if this will cause an effective BC break.