Skip to content

Commit

Permalink
Bugfix: event.organizer could be undefined #1745
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Sep 17, 2024
1 parent 02ef7c8 commit b5ff818
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions plugins/ics-viewer/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,22 @@
let jcalData = ICAL.parse(text)
var comp = new ICAL.Component(jcalData);
var vevent = comp.getFirstSubcomponent("vevent");
var event = new ICAL.Event(vevent);
var event = new ICAL.Event(vevent);
let VEVENT = {};
if(event.organizer.startsWith("mailto:")){
VEVENT.ORGANIZER_TXT=event.organizer.substr(7)
if (event.organizer && event.organizer.startsWith("mailto:")) {
VEVENT.ORGANIZER_TXT = event.organizer.substr(7)
VEVENT.ORGANIZER_MAIL = event.organizer
} else
VEVENT.ORGANIZER_TXT=event.organizer
VEVENT.ORGANIZER_TXT = event.organizer
VEVENT.SUMMARY = event.summary;
VEVENT.DTSTART = parseDate(vevent.getFirstPropertyValue("dtstart"));
VEVENT.DTEND = parseDate(vevent.getFirstPropertyValue("dtend"));
VEVENT.LOCATION = event.location;
VEVENT.ATTENDEE = []
for(let attendee of event.attendees){
for (let attendee of event.attendees) {
VEVENT.ATTENDEE.push(attendee.getFirstParameter("cn"));
}

if (VEVENT) {
VEVENT.rawText = text;
VEVENT.isCancelled = () => VEVENT.STATUS?.includes('CANCELLED');
Expand Down

0 comments on commit b5ff818

Please sign in to comment.