From ec6cc8314ee4703d364cd43b2d15e024c4ad23b4 Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Wed, 30 Sep 2020 17:24:23 +0100 Subject: [PATCH] [ML] Improve calendar ics file parsing --- .../settings/calendars/edit/import_modal/utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/import_modal/utils.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/import_modal/utils.js index 07bf49ea6d7db..e93abc8eb67b5 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/import_modal/utils.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/import_modal/utils.js @@ -42,7 +42,10 @@ export function filterEvents(events) { } export function parseICSFile(data) { - const cal = icalendar.parse_calendar(data); + // force a new line char on the end of the data + // icalendar must split on new lines and so parsing fails + // if there isn't at least one new line at the end. + const cal = icalendar.parse_calendar(data + '\n'); return createEvents(cal); }