Feature/ics rework/mime - #1657
Conversation
dba2310 to
8d04d13
Compare
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.
e3ac689 to
1e62cc7
Compare
Code reviewFound 1 issue:
librebooking/lib/Email/Messages/ReservationEmailMessage.php Lines 220 to 227 in 1e62cc7 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Added mime-type to ics attachment to improve RFC 5546 compliance and client event recognition. Added mime-type specific tests.
1e62cc7 to
3603f86
Compare
|
Code review is true but mimics the current behaviour of the ics implementation. actual correct method follows in the next PR |
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