DavMail generates invalid multistatus XML if .ics file is broken
Brought to you by:
mguessan
If there is some invalid ICS file on the server, DavMail will generate invalid XML for PROPFIND requests sent. Concretely:
</D:response> <D:response> <D:href>/users/dsantana@fnb.co.za/calendar/AAMkADFhNGYwNzJkLTE2YjEtNDA0ZC04YmQ2LWQ3YTdiOGYwY2Y2NABGAAAAAABWxfZAMOs7Q4UNDhZ5a505BwCqyWteSHs-RJcaDYcJcinrAAASxFepAAAlZPQvrhafTpQ54lmBac4TAAAE4kcaAAA%3D.EML</D:href> <D:propstat> <D:prop> <D:response> <D:href>/users/dsantana@fnb.co.za/calendar/isnjuf63v3fbv4phiad7iui8d8.ics</D:href> <D:propstat> <D:prop> <C:calendar-data xmlns:C="urn:ietf:params:xml:ns:caldav" C:content-type="text/calendar" C:version="2.0">[...]
Note that DavMail truncates the response content for the item AAMkA[...].ics
.
For more information, please see https://github.com/untitaker/vdirsyncer/issues/214#issuecomment-109724122
Unfortunately I can't give you a step-by-step way to reproduce this issue because I'm unable to upload any broken ICS files to Exchange through DavMail.
Also the PROPFIND request we send looks like this:
I experienced the related duplicate problem with davmail and Thunderbird/Lightning over the course of the last year. I had several duplicate events, seemingly caused by events created by others being updated. I'm not sure if the problem lies in Lightning or davmail.
I also encounter this problem with invalid characters, in my case an invalid timezone returned by an Exchange server:
(I replaced 0x00 characters by [NUL])
TZID:Paris, Madrid[NUL]2[NUL][NUL][NUL][NUL][NUL][NUL][NUL][NUL][NUL]
and this timezone is then copied to DTSTART and DTEND for the event, breaking the later generated XML
I see, so this behavior may be caused by NUL-characters in the response by Exchange? Interesting...
Well, looks like the best answer is to fix broken events on the server with:
https://www.microsoft.com/en-us/download/details.aspx?id=28786
Feel free to provide a better workaround on DavMail side :-)
I do think that DavMail's behavior in this case (generating syntactically invalid XML) is not acceptable. Even a Internal Server Error would be better.
Indeed, the issue is that I don't reproduce this behaviour here, and there are already many controls in the ICS parser => without more details I don't have enough info to improve current code.
Fair enough.