From b117c8b15c8dcaa5cf27c9e03e841c36fb82931f Mon Sep 17 00:00:00 2001 From: Joe Au-Yeung Date: Fri, 10 Jan 2025 10:16:55 -0500 Subject: [PATCH 1/2] Create dub links if valid --- packages/features/ee/workflows/lib/reminders/utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/features/ee/workflows/lib/reminders/utils.ts b/packages/features/ee/workflows/lib/reminders/utils.ts index 1e78cbcda3b6d4..5ac11257a44a67 100644 --- a/packages/features/ee/workflows/lib/reminders/utils.ts +++ b/packages/features/ee/workflows/lib/reminders/utils.ts @@ -1,6 +1,7 @@ import { dub } from "@calcom/features/auth/lib/dub"; export const bulkShortenLinks = async (links: string[]) => { + const linksToShorten = links.filter((link) => link.startsWith("http")); const results = await dub.links.createMany(links.map((link) => ({ domain: "sms.cal.com", url: link }))); return links.map((link) => { From 6e6368a447834109b051231658e80a4394aa5fc8 Mon Sep 17 00:00:00 2001 From: Joe Au-Yeung Date: Fri, 10 Jan 2025 10:32:06 -0500 Subject: [PATCH 2/2] Map through filtered links --- packages/features/ee/workflows/lib/reminders/utils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/features/ee/workflows/lib/reminders/utils.ts b/packages/features/ee/workflows/lib/reminders/utils.ts index 5ac11257a44a67..d60ea2c57a7f74 100644 --- a/packages/features/ee/workflows/lib/reminders/utils.ts +++ b/packages/features/ee/workflows/lib/reminders/utils.ts @@ -1,8 +1,10 @@ import { dub } from "@calcom/features/auth/lib/dub"; export const bulkShortenLinks = async (links: string[]) => { - const linksToShorten = links.filter((link) => link.startsWith("http")); - const results = await dub.links.createMany(links.map((link) => ({ domain: "sms.cal.com", url: link }))); + const linksToShorten = links.filter((link) => link !== ""); + const results = await dub.links.createMany( + linksToShorten.map((link) => ({ domain: "sms.cal.com", url: link })) + ); return links.map((link) => { const createdLink = results.find((result) => result.url === link);