Files
calendar/packages/emails/lib/generateIcsFile.ts
T
Anik Dhabal BabuandGitHub 97f1f7b130 chore: add content type to ics file (#24069)
* chore: add content type into ics file

* Update generateIcsFile.ts
2025-09-25 18:44:21 +00:00

43 lines
971 B
TypeScript

import type { TFunction } from "i18next";
import type { EventStatus } from "ics";
import type { CalendarEvent } from "@calcom/types/Calendar";
import generateIcsString from "./generateIcsString";
export enum GenerateIcsRole {
ATTENDEE = "attendee",
ORGANIZER = "organizer",
}
export default function generateIcsFile({
calEvent,
role,
status,
t,
}: {
calEvent: CalendarEvent;
role: GenerateIcsRole;
status: EventStatus;
t?: TFunction;
}) {
// O365 deletes emails if the calendar event is selected. Currently no option to disable this on the web
if (
role !== GenerateIcsRole.ATTENDEE &&
calEvent.destinationCalendar &&
calEvent.destinationCalendar[0]?.integration === "office365_calendar"
)
return null;
return {
filename: "event.ics",
content: generateIcsString({
event: calEvent,
status,
t,
}),
type: "text/calendar; charset=UTF-8; method=REQUEST",
disposition: "attachment",
};
}