sabre-io/Baikal

Baikal sets `cal:calendar-timezone` to a timezone string instead of a VTIMEZONE when creating a new calendar via the web UI

apollo-sturdy opened this issue · 7 comments

Baikal version: 0.9.4

Expected behaviour:

Baikal should set the field to a correct iCalendar object with a VTIMEZONE. This causes the following bug: #1085 which causes integrations to fail with Cal.com and HomeAssistant.

Current behaviour:

Baikal sets the field to the timzone string from the settings.

Steps to reproduce:

  1. Install Baikal
  2. Create new calendar
  3. Check cal:calendar-timezone field

For any readers here, as a temporary fix you can re-create your calendars in iCal (MacOS Calendar app): #1085 (comment)

Please fix this. I don't have iCal. :/

I'm also very intererested in getting a solution for the manual installation on a webhosting service.

I'm also very intererested in getting a solution for the manual installation on a webhosting service.

I replaced the baikal\vendor\sabre\dav\lib\CalDAV\Plugin.php from the release baikal-0.9.5.zip with the the baikal-docker-hass/files/Plugin.php and now it works also with Home Assistant.

You ca solve the problem like this:

edit the baikal-file: /vendor/sabre/dav/lib/CalDAV/Plugin.php

        if ($report->expand) {
            // We're expanding, and for that we need to figure out the
            // calendar's timezone.
            $tzProp = '{'.self::NS_CALDAV.'}calendar-timezone';
            $tzResult = $this->server->getProperties($path, [$tzProp]);
            if (isset($tzResult[$tzProp])) {
                // This property contains a VCALENDAR with a single
                // VTIMEZONE.
                $vtimezoneObj = VObject\Reader::read($tzResult[$tzProp]);
                $calendarTimeZone = $vtimezoneObj->VTIMEZONE->getTimeZone();

                // Destroy circular references so PHP will garbage collect the
                // object.
                $vtimezoneObj->destroy();
            } else {
                // Defaulting to UTC.
                $calendarTimeZone = new DateTimeZone('UTC');
            }
        }

=>

        if ($report->expand) {
            // We're expanding, and for that we need to figure out the
            // calendar's timezone.
            $tzProp = '{'.self::NS_CALDAV.'}calendar-timezone';
            $tzResult = $this->server->getProperties($path, [$tzProp]);
            if (isset($tzResult[$tzProp])) {
                $calendarTimeZone = new DateTimeZone($tzResult[$tzProp]);
            } else {
                // Defaulting to UTC.
                $calendarTimeZone = new DateTimeZone('UTC');
            }
        }

do a PR for that.