Skip to content

Multi-day ICS downloads drop location, URL, description and coordinates #192

Description

@edalzell

Downloading a multi-day event without a date param returns an .ics missing every field except the title and times — no LOCATION, no URL, no DESCRIPTION, no GEO.

MultiDayEvent::toICalendarEvents() maps each day through Day::toICalendarEvent(), which only sets UID, DTSTART and DTEND. The single-date route (toICalendarEvent()) decorates properly, which is why this has gone unnoticed.

Underlying cause is duplication: the address/coordinates/description/url block is copy-pasted in three places — Event.php:116-130, MultiDayEvent.php:67-81, RecurringEvent.php:36-50 — and simply missing from the fourth path.

Fix

Add protected function decorate(ICalendarEvent $iCalEvent): ICalendarEvent to the base Event holding that block, and call it from all four sites. Day stays ignorant of location — it's about dates and times — so MultiDayEvent decorates what Day returns. Removing the duplication and fixing the bug is the same edit.

While in there, guard coordinates before it reaches spatie's coordinates(float $lat, float $lng). A partial or non-numeric value is a TypeError, i.e. a 500 on a public download route — the same crash class as #184.

Tests

TDD — write these failing first. In tests/Http/Contollers/IcsControllerTest.php:

  • multi-day event downloaded with no date param emits LOCATION:, URL:, DESCRIPTION: and GEO: on every day
  • the three already-working routes still emit them (regression guard against the refactor)
  • coordinates missing longitude doesn't fatal, and emits no GEO:
  • coordinates with non-numeric values doesn't fatal

Docs

No user-facing contract change, so nothing beyond whatever the field table says after #191.

Branch

fix/multi-day-ics-missing-fields off 6.x, then forward-merge to main — later steps build on decorate().

Part of #190.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions