From 8a2d8e86a57adfac48160ea967d2f8d00b413e65 Mon Sep 17 00:00:00 2001 From: Fathi Ben Nasr Date: Fri, 14 Aug 2026 10:12:06 +0000 Subject: [PATCH] ics-viewer: unwrap attachments and widen the calendar part match The panel never appears on a real invitation. msg.attachments is a ko.observableArray, so msg.attachments.find() is undefined and throws inside the message subscription - the rest of the handler, including the JSON-LD path, dies with it. The app itself always writes attachments(). A scheduling mail also does not necessarily carry a text/calendar attachment. Evolution and Exchange put the scheduling part inline in multipart/alternative as text/calendar and repeat it as an application/ics attachment, so such a message shows two .ics files and the current test matches neither reliably. Match text/calendar, application/ics, text/x-vcalendar or an .ics file name - which is what the commented-out line above was reaching for. --- plugins/ics-viewer/message.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/ics-viewer/message.js b/plugins/ics-viewer/message.js index 380b732bb..b0adc469d 100644 --- a/plugins/ics-viewer/message.js +++ b/plugins/ics-viewer/message.js @@ -86,10 +86,17 @@ }); } }); - // ICS attachment -// let ics = msg.attachments.find(attachment => 'application/ics' == attachment.mimeType); - - let ics = msg.attachments.find(attachment => 'text/calendar' == attachment.mimeType); + // ICS attachment. + // attachments is a ko.observableArray, so it must be + // unwrapped before array methods are used on it. + // A scheduling mail does not always carry a text/calendar + // attachment either: the part is often inline inside + // multipart/alternative and repeated as application/ics. + let ics = (msg.attachments() || []).find(attachment => + 'text/calendar' == attachment.mimeType + || 'application/ics' == attachment.mimeType + || 'text/x-vcalendar' == attachment.mimeType + || /\.ics$/i.test(attachment.fileName || '')); if (ics && ics.download) { // fetch it and parse the VEVENT