From ccf98c0c22b16ccbebd3fca9b1a20b2e8b51fed7 Mon Sep 17 00:00:00 2001 From: rejas Date: Tue, 24 Nov 2020 21:32:16 +0100 Subject: [PATCH 1/2] Surround ical parsing with try/catch to catch unknown bugs --- modules/default/calendar/calendarfetcher.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 7cb4434c..f6f84d71 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -76,7 +76,16 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn return; } - const data = ical.parseICS(requestData); + let data = []; + + try { + data = ical.parseICS(requestData); + } catch (error) { + fetchFailedCallback(self, error.message); + scheduleTimer(); + return; + } + const newEvents = []; // limitFunction doesn't do much limiting, see comment re: the dates array in rrule section below as to why we need to do the filtering ourselves From 38d4a8b1987cf6576a496fc33e14942988383e6c Mon Sep 17 00:00:00 2001 From: rejas Date: Tue, 24 Nov 2020 21:33:14 +0100 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41e39aec..fc068f8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ _This release is scheduled to be released on 2021-01-01._ - Add a space after icons of sunrise and sunset (#2169) - Fix calendar when no DTEND record found in event, startDate overlay when endDate set (#2177) - Fix calendar full day event east of UTC start time (#2200) +- Catch errors when parsing calendar data with ical (#2022) ## [2.13.0] - 2020-10-01