Skip to content

Scheduling infrastructure for absolutely everyone.

fix: strip internal $RCH$ prefix from cancellation reason in ICS files (#25016)

Kartik9a52938f64ea
diff --git a/packages/lib/CalEventParser.ts b/packages/lib/CalEventParser.ts
index 03e1b6ac6f7..22edbe74795 100644
--- a/packages/lib/CalEventParser.ts
+++ b/packages/lib/CalEventParser.ts
@@ -223,8 +223,9 @@ export const getPlatformCancelLink = (
if (calEvent.platformCancelUrl) {
const platformCancelLink = new URL(`${calEvent.platformCancelUrl}/${bookingUid}`);
platformCancelLink.searchParams.append("slug", calEvent.type);
- calEvent.organizer.username &&
+ if (calEvent.organizer.username) {
platformCancelLink.searchParams.append("username", calEvent.organizer.username);
+ }
platformCancelLink.searchParams.append("cancel", "true");
platformCancelLink.searchParams.append("allRemainingBookings", String(!!calEvent.recurringEvent));
if (seatUid) platformCancelLink.searchParams.append("seatReferenceUid", seatUid);
@@ -267,8 +268,9 @@ export const getPlatformRescheduleLink = (
`${calEvent.platformRescheduleUrl}/${seatUid ? seatUid : bookingUid}`
);
platformRescheduleLink.searchParams.append("slug", calEvent.type);
- calEvent.organizer.username &&
+ if (calEvent.organizer.username) {
platformRescheduleLink.searchParams.append("username", calEvent.organizer.username);
+ }
platformRescheduleLink.searchParams.append("reschedule", "true");
if (calEvent?.team) platformRescheduleLink.searchParams.append("teamId", calEvent.team.id.toString());
return platformRescheduleLink.toString();
@@ -408,7 +410,10 @@ export const getRichDescription = (
export const getCancellationReason = (calEvent: Pick<CalendarEvent, "cancellationReason">, t: TFunction) => {
if (!calEvent.cancellationReason) return "";
- return `${t("cancellation_reason")}:\n${calEvent.cancellationReason}`;
+ const sanitized = calEvent.cancellationReason.startsWith("$RCH$")
+ ? calEvent.cancellationReason.substring(5).trim()
+ : calEvent.cancellationReason.trim();
+ return `${t("cancellation_reason")}:\n${sanitized}`;
};
export const isDailyVideoCall = (calEvent: Pick<CalendarEvent, "videoCallData">): boolean => {