Skip to content

Commit

Permalink
fix: Ignore missing attendee properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrl-q committed Jan 25, 2025
1 parent c425ed8 commit f800d01
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ export default class ICSPlugin extends Plugin {
callUrl: callUrl,
callType: callType,
eventType: e.eventType,
organizer: { email: e.organizer?.val.substring(7) || null, name: e.organizer?.params?.CN || null },
organizer: { email: e.organizer?.val?.substring(7) || null, name: e.organizer?.params?.CN || null },
attendees: e.attendee ? (Array.isArray(e.attendee) ? e.attendee : [e.attendee]).map(attendee => ({
name: attendee.params.CN,
email: attendee.val.substring(7),
status: attendee.params.PARTSTAT,
role: attendee.params.ROLE,
type: attendee.params.CUTYPE || "INDIVIDUAL"
name: attendee.params?.CN,
email: attendee.val?.substring(7),
status: attendee.params?.PARTSTAT,
role: attendee.params?.ROLE,
type: attendee.params?.CUTYPE || "INDIVIDUAL"
})) : []
};
events.push(event);
Expand Down Expand Up @@ -224,7 +224,7 @@ export default class ICSPlugin extends Plugin {
const ownerEmail = calendarSetting.ownerEmail?.toLowerCase().trim();
if (ownerEmail) {
const myAttendee = event.attendees.find((att: any) => {
const attEmail = att.val.replace("mailto:", "").toLowerCase().trim();
const attEmail = att.val?.replace("mailto:", "").toLowerCase().trim();
return attEmail === ownerEmail;
});

Expand Down

0 comments on commit f800d01

Please sign in to comment.