SLYtiger16 / caldavjs-nextcloud

CalDav integration for Nextcloud and others
MIT License
6 stars 1 forks source link

Problem with DSTART in some ics entries #3

Open olafthiele opened 3 years ago

olafthiele commented 3 years ago

If DSTART contains just the time without timezone as zoom does, the error below is thrown. Line 157 should be changed to:

evt.allDay = (parsed[DTSTART;TZID=${self.timezone}] || parsed[DTSTART;VALUE=DATE] || parsed[DTSTART]).length === 8;

W20201127-09:21:45.019(1)? (STDERR)               evt.allDay = (parsed[`DTSTART;TZID=${self.timezone}`] || parsed[`DTSTART;VALUE=DATE`]).length
 === 8;
W20201127-09:21:45.020(1)? (STDERR)                                                                                                      ^
W20201127-09:21:45.020(1)? (STDERR)
W20201127-09:21:45.020(1)? (STDERR) TypeError: Cannot read property 'length' of undefined
W20201127-09:21:45.021(1)? (STDERR)     at C:\data\code\node\times\node_modules\caldavjs-nextcloud\index.js:159:102
W20201127-09:21:45.021(1)? (STDERR)     at onComplete (C:\data\code\node\times\node_modules\ical-parser\lib\index.js:115:10)
W20201127-09:21:45.022(1)? (STDERR)     at C:\data\code\node\times\node_modules\ical-parser\node_modules\async\dist\async.js:969:16
W20201127-09:21:45.022(1)? (STDERR)     at next (C:\data\code\node\times\node_modules\ical-parser\node_modules\async\dist\async.js:5225:18)
W20201127-09:21:45.023(1)? (STDERR)     at iteratee (C:\data\code\node\times\node_modules\ical-parser\lib\index.js:98:3)
W20201127-09:21:45.023(1)? (STDERR)     at next (C:\data\code\node\times\node_modules\ical-parser\node_modules\async\dist\async.js:5223:28)

W20201127-09:21:45.024(1)? (STDERR)     at iteratee (C:\data\code\node\times\node_modules\ical-parser\lib\index.js:98:3)
W20201127-09:21:45.024(1)? (STDERR)     at Object.whilst (C:\data\code\node\times\node_modules\ical-parser\node_modules\async\dist\async.js:522
7:5)
W20201127-09:21:45.025(1)? (STDERR)     at process (C:\data\code\node\times\node_modules\ical-parser\lib\index.js:118:8)
W20201127-09:21:45.025(1)? (STDERR)     at C:\data\code\node\times\node_modules\ical-parser\lib\index.js:62:3
W20201127-09:21:45.026(1)? (STDERR)     at C:\data\code\node\times\node_modules\ical-parser\node_modules\async\dist\async.js:473:16
W20201127-09:21:45.026(1)? (STDERR)     at iteratorCallback (C:\data\code\node\times\node_modules\ical-parser\node_modules\async\dist\async.js:
1064:13)
W20201127-09:21:45.027(1)? (STDERR)     at C:\data\code\node\times\node_modules\ical-parser\node_modules\async\dist\async.js:969:16
W20201127-09:21:45.028(1)? (STDERR)     at C:\data\code\node\times\node_modules\ical-parser\node_modules\async\dist\async.js:3263:30
W20201127-09:21:45.028(1)? (STDERR)     at Immediate.<anonymous> (C:\data\code\node\times\node_modules\ical-parser\node_modules\async\dist\asyn
c.js:119:16)
W20201127-09:21:45.029(1)? (STDERR)     at processImmediate (internal/timers.js:456:21)
SLYtiger16 commented 3 years ago

Good catch, PR?

olafthiele commented 3 years ago

Will do, have to check. Looks like it doesn't catch the right start time in that case.

olafthiele commented 3 years ago

Problematic ICS that leads to the error for future reference (stems from zoom):

{ UID: 'e0318e97-df91-4392-97d4-9d97e1ee7319', URL: 'httpsngels-and-starts-ups-tickets-127629403983', DTSTART: '20201127T100000Z', DTEND: '20201127T130000Z', SUMMARY: 'Workshop', LOCATION: '', DTSTAMP: '20201121T195322Z', DESCRIPTION: '\n httpsead.zoom.us/w/939196', SEQUENCE: '1', 'LAST-MODIFIED': '20201121T195322Z' }

Problem with line above: Start times is always current time and not the given start time.

olafthiele commented 3 years ago

Solved by #4