mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 10:09:20 +03:00
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.
This commit is contained in:
parent
c154d23cfe
commit
8a2d8e86a5
1 changed files with 11 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue