From d349f6536adabedf2d5b48716c76185604bcc03d Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Fri, 15 Sep 2023 19:24:25 +0530 Subject: [PATCH] fix: Embed - app.cal.com instead of cal.com (#11384) * Fix yarn.lock * Force app.cal.com because Safari and rewrites using referrer * Add comment --- packages/embeds/embed-core/src/embed.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/embeds/embed-core/src/embed.ts b/packages/embeds/embed-core/src/embed.ts index a8db717899..ef08c29e4b 100644 --- a/packages/embeds/embed-core/src/embed.ts +++ b/packages/embeds/embed-core/src/embed.ts @@ -278,7 +278,12 @@ export class Cal { } } - const urlInstance = new URL(`${calOrigin || config.calOrigin}/${calLink}`); + // cal.com has rewrite issues on Safari that sometimes cause 404 for assets. + const originToUse = (calOrigin || config.calOrigin || "").replace( + "https://cal.com", + "https://app.cal.com" + ); + const urlInstance = new URL(`${originToUse}/${calLink}`); if (!urlInstance.pathname.endsWith("embed")) { // TODO: Make a list of patterns that are embeddable. All except that should be allowed with a warning that "The page isn't optimized for embedding" urlInstance.pathname = `${urlInstance.pathname}/embed`;