Skip to content

[Enhancement]: migrate ICS export to sabre/vobject #1478

@JohnVillalovos

Description

@JohnVillalovos

Summary

The project already depends on sabre/vobject (^4.5) and uses it for ICS import (ICalImportPresenter), but the ICS export path builds calendar output by hand via a raw Smarty template (tpl/Export/ical.tpl) and manual string manipulation in iCalendarReservationView.

Current problems

  • Manual RFC 5545 text escapingiCalendarReservationView::toRfc5545Text() was added to escape SUMMARY and DESCRIPTION, but LOCATION, ORGANIZER;CN=, and any ExtraIcalLines values are still unescaped.
  • No line folding — RFC 5545 §3.1 requires lines longer than 75 octets to be folded with CRLF + SPACE. The current template does not fold at all, producing invalid output for long titles or descriptions.
  • Manual RRULE constructionCreateRecurRule() hand-builds recurrence rule strings; sabre/vobject has a Recur value type for this.
  • Fragile template — The Smarty template emits raw property values with no guarantee of correct encoding, making it easy for future changes to introduce spec violations.

sabre/vobject handles all of the above automatically when properties are set through its object model.

Proposed change

Replace the hand-rolled Smarty template + iCalendarReservationView string escaping with a vobject-based builder that:

  1. Constructs a VCALENDAR / VEVENT object model via Sabre\VObject\Component\VCalendar.
  2. Sets SUMMARY, DESCRIPTION, LOCATION, ORGANIZER, and other text properties through the vobject API (automatic escaping and line folding).
  3. Serialises the calendar with $vcalendar->serialize() instead of rendering the Smarty template.
  4. Removes toRfc5545Text() and CreateRecurRule() as they become redundant.

Acceptance criteria

  • All text properties are correctly escaped per RFC 5545 §3.3.11
  • Output lines are folded at 75 octets per RFC 5545 §3.1
  • Existing unit tests for iCalendarReservationView continue to pass (or are updated to assert on parsed vobject output)
  • Exported .ics files are accepted without warnings by at least Google Calendar and Thunderbird
  • Participants are serialised as ATTENDEE properties so calendar clients (Outlook, Google Calendar) recognize the event as a meeting invitation (addresses [Bug] Meeting invitation emails cannot be recognized #1336)

Related Issues

Issue #1336

Assisted-by: Claude:claude-sonnet-4-6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions