Feature/ics rework/mime - #1657
Open
lucs7 wants to merge 1 commit into
Open
Conversation
lucs7
force-pushed
the
feature/ics-rework/mime
branch
2 times, most recently
from
August 22, 2026 11:40
dba2310 to
8d04d13
Compare
lucs7
marked this pull request as ready for review
August 26, 2026 08:15
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends LibreBooking’s email attachment pipeline so IEmailMessage string attachments can optionally provide an explicit MIME Content-Type, allowing reservation .ics attachments to be sent with text/calendar; ...; method=REQUEST instead of relying on filename-based detection. It also incorporates the attachment-leak fix from the dependent PR (#1656) by clearing PHPMailer attachments before each send.
Changes:
- Add optional
$mimeTypesupport toIEmailMessage::AddStringAttachment(...)and propagate it throughEmailMessage+EmailServiceinto PHPMailer’saddStringAttachment(...). - Update reservation ICS generation to set an explicit calendar MIME type.
- Add PHPUnit coverage for EmailService attachment clearing and MIME passthrough.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/lib/Email/EmailServiceTest.php | Adds unit tests for clearing attachments per send and passing MIME type into PHPMailer. |
| tests/fakes/FakeEmailMessage.php | Introduces a minimal IEmailMessage fake that supports string attachments + optional MIME type. |
| tests/fakes/TestReservationEmailMessage.php | Adds a reservation-email fake intended to expose ICS attachment generation for testing. |
| tests/fakes/namespace.php | Registers new fakes in the global test bootstrap. |
| lib/Email/IEmailMessage.php | Extends the interface to accept/return attachment MIME type. |
| lib/Email/EmailMessage.php | Stores and exposes the optional attachment MIME type. |
| lib/Email/EmailService.php | Clears attachments before each send and forwards MIME type to PHPMailer. |
| lib/Email/Messages/ReservationEmailMessage.php | Sets the ICS attachment MIME type to text/calendar; charset=UTF-8; method=REQUEST. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+222
to
+226
| $this->AddStringAttachment( | ||
| $icsContents, | ||
| 'reservation.ics', | ||
| 'text/calendar; charset=UTF-8; method=REQUEST' | ||
| ); |
lucs7
force-pushed
the
feature/ics-rework/mime
branch
from
August 26, 2026 19:44
8d04d13 to
e3ac689
Compare
Added mime-type to ics attachment to improve RFC 5546 compliance and client event recognition. Added mime-type specific tests.
lucs7
force-pushed
the
feature/ics-rework/mime
branch
from
August 28, 2026 18:54
e3ac689 to
1e62cc7
Compare
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.
This pull request enhances the email attachment handling system by allowing MIME types to be specified for string attachments, ensuring correct content types are used when sending emails.
Depends on #1656