DavMail CalDAV adds METHOD-property to iCalendar objects
Brought to you by:
mguessan
The iCalendar objects returned by DavMail's CalDAV server contain METHOD-properties, in our case METHOD:PUBLISH. Those are semantically invalid in the context of CalDAV, see Section 4.1 of RFC 4791:
Calendar object resources contained in calendar collections MUST NOT specify the iCalendar METHOD property.
This little detail actually has practical consequences, as servers like SabreDAV actually reject iCalendar objects with a METHOD property. See https://github.com/pimutils/vdirsyncer/issues/502 for the full background.
When I grep the sourcecode of DavMail, it appears that this property may have been added by Exchange, but DavMail has extra code to insert that property if it is missing: https://sourceforge.net/p/davmail/code/HEAD/tree/trunk/src/java/davmail/exchange/VCalendar.java#l155 I seriously wonder what is going on here. Is this code there to adapt to the requirements imposed by Exchange?
Indeed, the METHOD property was required by Exchange, and at some point the iPhone implementation stopped sending it => We now force it in DavMail code.
Interestingly trying to troubleshoot your issue I found this discussion:
event with METHOD not accepted by OC -- but it's RFC compliant! (CalDAV)
https://github.com/owncloud/apps/issues/569
Note tha METHOD: PUBLISH is in:
iCalendar Transport-Independent Interoperability Protocol (iTIP) December 2009
https://tools.ietf.org/html/rfc5546#section-3.2.1
But not in:
Scheduling Extensions to CalDAV June 2012
https://tools.ietf.org/html/rfc6638
SabreDAV decided to be strictly compliant to RFC... just have to decide which one.
We try to follow the robustness principle:
DavMail is not exposing those methods as part of the API defined by "Scheduling Extensions to CalDAV" or the API exposed by iTIP, but rather during normal usage of the core CalDAV API. This is the only API that concerns me and this is also the API where SabreDAV refuses METHOD:PUBLISH during upload.
Thanks for your feedback, you could try to remove METHOD from all events sent from the server, at it seems all other Caldav clients don't care about this property:
In VCalendar.fixVCalendar:
Last edit: Mickael Guessant 2016-12-24
That would work for me, however, I don't think the second conditional
"PUBLISH".equals(getPropertyValue("METHOD"))is necessary. There is no situation where it would be valid for the server to return theMETHODproperty.Could you apply this patch (or something like it) to DavMail?
The same code is used to retrieve ITIP messages from inbox => we have to accept METHOD property in this case.
Fix available in subversion
Fixed a while ago