forwardemail / caldav-adapter

CalDAV server for Node.js and Koa. Modernized and maintained for @forwardemail
https://forwardemail.net
MIT License
27 stars 9 forks source link

getEventsByDate seems to have not the correct response for iCal #6

Closed 4myhealth closed 3 years ago

4myhealth commented 4 years ago

if you set your phone (iPhone) to only sync the calendar in the last 3 months, then the calendarapp does not show any appointments anymore.

the response xml of getEventsByDate is different to getEventsForCalendar.

the response of getEventsByDate:

\n /caldav/cal/mh%404myhealth/3/3c650653-aaf3-11ea-92ee-134a1fc8b503.ics\n \n HTTP/1.1 200 OK\n \n response of getEventsForCalendar: \n /caldav/cal/mh%404myhealth/3/3c650653-aaf3-11ea-92ee-134a1fc8b503.ics\n \n HTTP/1.1 200 OK\n \n text/calendar; charset=utf-8; component=VEVENT\n \n \n \n after the client received the response of getEventsForCalendar, the client is loading every single event. thats not the case for getEventsByDate. maybe because of the missing "D:getcontenttype" tag. i hope this helps to fixing the issue.
sedenardi commented 4 years ago

I'm having trouble understanding the problem. If you have events in the future, but none in the past, and set your iPhone to only sync the calendar in the last 3 months, wouldn't it be correct to not show any appointments anymore?

4myhealth commented 4 years ago

to avoid loading the complete calendar, you can set your phone to sync only with last 3 months + all future events. in that case, the phone shows not a single event (i have events in the past and future.).

what i found, the phone loads the xml with the list of events for given calender or daterange. after the list received the phone loads every single event for detailed information. in case of getEventsForCalender it works fine. in case of getEventsByDate the phone does not load the single events for detailed information. i looked at the response and found a difference i mentioned in my first comment.

i could provide some screenshots if you want me too :)

HeikoTheissen commented 3 years ago

The problem is with the parsing of the request

<?xml version="1.0" encoding="UTF-8"?>
<L:calendar-query xmlns:L="urn:ietf:params:xml:ns:caldav">
 <D:prop xmlns:D="DAV:">
  <D:getcontenttype/>
  <D:getetag/>
  <L:calendar-data/>
 </D:prop>
 <L:filter>
  <L:comp-filter name="VCALENDAR">
   <L:comp-filter name="VEVENT">
    <L:time-range start="..." end="..."/>
   </L:comp-filter>
  </L:comp-filter>
 </L:filter>
</L:calendar-query>

The children of the calendar-query element are overlooked by the statement

xml.getWithChildren('/CAL:calendar-query/D:prop', ctx.request.xml);

because the getWithChildren method is "hardwired" to the path /D:propfind/D:prop, see here.

4myhealth commented 2 years ago

thanks for fixing! works fine now! <3