Skip to content

Commit 9a52938

Browse files
fix: strip internal $RCH$ prefix from cancellation reason in ICS files (calcom#25016)
* fix: strip internal RCH prefix from cancellation reason used in ICS * fixed * trimmed
1 parent e24e1d8 commit 9a52938

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

packages/lib/CalEventParser.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,9 @@ export const getPlatformCancelLink = (
223223
if (calEvent.platformCancelUrl) {
224224
const platformCancelLink = new URL(`${calEvent.platformCancelUrl}/${bookingUid}`);
225225
platformCancelLink.searchParams.append("slug", calEvent.type);
226-
calEvent.organizer.username &&
226+
if (calEvent.organizer.username) {
227227
platformCancelLink.searchParams.append("username", calEvent.organizer.username);
228+
}
228229
platformCancelLink.searchParams.append("cancel", "true");
229230
platformCancelLink.searchParams.append("allRemainingBookings", String(!!calEvent.recurringEvent));
230231
if (seatUid) platformCancelLink.searchParams.append("seatReferenceUid", seatUid);
@@ -267,8 +268,9 @@ export const getPlatformRescheduleLink = (
267268
`${calEvent.platformRescheduleUrl}/${seatUid ? seatUid : bookingUid}`
268269
);
269270
platformRescheduleLink.searchParams.append("slug", calEvent.type);
270-
calEvent.organizer.username &&
271+
if (calEvent.organizer.username) {
271272
platformRescheduleLink.searchParams.append("username", calEvent.organizer.username);
273+
}
272274
platformRescheduleLink.searchParams.append("reschedule", "true");
273275
if (calEvent?.team) platformRescheduleLink.searchParams.append("teamId", calEvent.team.id.toString());
274276
return platformRescheduleLink.toString();
@@ -408,7 +410,10 @@ export const getRichDescription = (
408410

409411
export const getCancellationReason = (calEvent: Pick<CalendarEvent, "cancellationReason">, t: TFunction) => {
410412
if (!calEvent.cancellationReason) return "";
411-
return `${t("cancellation_reason")}:\n${calEvent.cancellationReason}`;
413+
const sanitized = calEvent.cancellationReason.startsWith("$RCH$")
414+
? calEvent.cancellationReason.substring(5).trim()
415+
: calEvent.cancellationReason.trim();
416+
return `${t("cancellation_reason")}:\n${sanitized}`;
412417
};
413418

414419
export const isDailyVideoCall = (calEvent: Pick<CalendarEvent, "videoCallData">): boolean => {

0 commit comments

Comments
 (0)