apple / ccs-calendarserver

The Calendar and Contacts Server.
https://www.calendarserver.org
Apache License 2.0
484 stars 136 forks source link

PUT todo object (sync from older server) and err=supported-calendar-component #515

Open controlcde opened 6 years ago

controlcde commented 6 years ago

I will sync from calendarserver 3.2 to a new one. I use the great software vdirsyncer. When I want to sync my todos the new server through out the following error:

[19/Jun/2018:13:11:58 +0000] "PUT /calendars/__uids__/10000000-0000-0000-0000-000000000003/calendar/1365B599-99E5-4AEA-AFE2-28C49E6C7198.ics HTTP/1.1" 403 303 "-" "reqwest/0.8.5" i=7 or=1 t=55.0 cl=399 err=supported-calendar-component fwd=192.168.0.131
[19/Jun/2018:13:11:58 +0000] "PUT /calendars/__uids__/10000000-0000-0000-0000-000000000003/calendar/3D60A6EB-31B2-427F-B8F5-63004C4F6317.ics HTTP/1.1" 403 303 "-" "reqwest/0.8.5" i=7 or=1 t=54.8 cl=398 err=supported-calendar-component fwd=192.168.0.131
[19/Jun/2018:13:11:58 +0000] "PUT /calendars/__uids__/10000000-0000-0000-0000-000000000003/calendar/7C8D5254-2A11-42B6-B5BD-3ADBEEA6176B.ics HTTP/1.1" 403 303 "-" "reqwest/0.8.5" i=7 or=1 t=69.0 cl=1033 err=supported-calendar-component fwd=192.168.0.131
[19/Jun/2018:13:11:58 +0000] "PUT /calendars/__uids__/10000000-0000-0000-0000-000000000003/calendar/88EEB7B5-2C86-4CC5-BCD3-220814C0720E.ics HTTP/1.1" 403 303 "-" "reqwest/0.8.5" i=7 or=1 t=37.4 cl=1060 err=supported-calendar-component fwd=192.168.0.131
[19/Jun/2018:13:11:58 +0000] "PUT /calendars/__uids__/10000000-0000-0000-0000-000000000003/calendar/B3912D79-D181-4147-9FB8-E622165C3306.ics HTTP/1.1" 403 303 "-" "reqwest/0.8.5" i=7 or=1 t=45.2 cl=1107 err=supported-calendar-component fwd=192.168.0.131
[19/Jun/2018:13:11:58 +0000] "PUT /calendars/__uids__/10000000-0000-0000-0000-000000000003/calendar/FE057A94-6B4B-4428-B6C6-2E2CCE66C7B8.ics HTTP/1.1" 403 303 "-" "reqwest/0.8.5" i=7 or=1 t=58.3 cl=1034 err=supported-calendar-component fwd=192.168.0.131

And for example one .ics file contains:

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//Apple Inc.//iOS 7.1.1//EN
BEGIN:VTODO
UID:1365B599-95E5-4AEA-AFE2-28C49E6C7198
COMPLETED:20150114T225231Z
CREATED:20141227T223526Z
DTSTAMP:20150114T225234Z
LAST-MODIFIED:20150114T225233Z
PERCENT-COMPLETE:100
SEQUENCE:0
STATUS:COMPLETED
SUMMARY:TEST
END:VTODO
BEGIN:X-CALENDARSERVER-PERUSER
UID:1365B599-95E5-4AEA-AFE2-28C49E6C7198
X-CALENDARSERVER-PERUSER-UID:31727124-d0d8-5127-a3f8-a297a4ec0d1f
BEGIN:X-CALENDARSERVER-PERINSTANCE
X-APPLE-SORT-ORDER:441412526
END:X-CALENDARSERVER-PERINSTANCE
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR

and a second one:

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//Apple Inc.//iOS 7.1.1//EN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
BEGIN:DAYLIGHT
DTSTART:19810329T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
TZNAME:MESZ
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:19961027T030000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:MEZ
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
END:STANDARD
END:VTIMEZONE
BEGIN:VTODO
UID:FE017A94-6B4B-4428-B6C6-2E2CCE66C7B8
DTSTART;TZID=Europe/Berlin:20140618T190000
DUE;TZID=Europe/Berlin:20140618T190000
COMPLETED:20140630T104655Z
CREATED:20140617T220847Z
DTSTAMP:20140630T104658Z
LAST-MODIFIED:20140630T104657Z
PERCENT-COMPLETE:100
SEQUENCE:1
STATUS:COMPLETED
SUMMARY:TESTäü?
END:VTODO
BEGIN:X-CALENDARSERVER-PERUSER
UID:FE057A94-6B4B-4428-B6C6-2E2CCE66C7B8
X-CALENDARSERVER-PERUSER-UID:31727124-20d8-5127-a3f8-a297a4ec0d1f
BEGIN:X-CALENDARSERVER-PERINSTANCE
X-APPLE-SORT-ORDER:424735727
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:Erinnerung
TRIGGER;VALUE=DATE-TIME:20140618T170000Z
UID:A4EDA363-03AD-4642-87A3-F2118CA89858
X-WR-ALARMUID:A4EDA363-03AD-4642-87A3-F2118CA89858
END:VALARM
END:X-CALENDARSERVER-PERINSTANCE
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR

Are the .ics files are corrupt or is this a bug?

dreness commented 6 years ago

Hi,

This error is “expected”. It used to be possible to store multiple calendar component types (eg VTODO, VEVENT) in a single collection. Sometime since 3.2, CalendarServer became more strict, and now does not let you mix component types in a single collection by default. You should put VTODOs to a collection that is configured to store only VTODOs.

Or, you can change the server config to relax this constraint; check https://github.com/apple/ccs-calendarserver/blob/a5b19e00a25f16ff2d56f899228bc6432b8b8828/conf/caldavd-stdconfig.plist#L1041

cyrusdaboo commented 6 years ago

Hi,

--On June 19, 2018 at 9:14:57 AM -0700 Andre LaBranche notifications@github.com wrote:

This error is “expected”. It used to be possible to store multiple calendar component types (eg VTODO, VEVENT) in a single collection. Sometime since 3.2, CalendarServer became more strict, and now does not let you mix component types in a single collection by default. You should put VTODOs to a collection that is configured to store only VTODOs.

Or, you can change the server config to relax this constraint; check https://github.com/apple/ccs-calendarserver/blob/a5b19e00a25f16ff2d56f899 228bc6432b8b8828/conf/caldavd-stdconfig.plist#L1041

Actually I think the issue here is attempting to store the "private" X- components via PUT.

CalendarServer stores iCalendar data internally with special "private" components that are used to capture additional metadata such as per-user properties in events in shared calendars. Those private components are never exposed to clients (when a client does a GET we process the "raw" calendar data to remove/merge the private metadata components as needed). The server will reject any attempt to store calendar data with those components if received over HTTP (or some other channel like email invitations).

So, it is never OK to take "raw" calendar data from CalendarServer's files (for file-system based data) or directly from postgres, and PUT those back via HTTP.

So your options are:

1) For each event, GET it from the old server and PUT it to the new one (HTTP-based solution). 2) Copy the actual file system datastore from the old server to the new one and let CalendarServer migrate that to postgres itself.

We also have an "export" tool that will dump all the events in one calendar into a single iCalendar file that can then be used for an import operation using a client configured to use the new server. That is a manual process so it only makes sense if you have a few users/calendars.

-- Cyrus Daboo