Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update utils.ts

Steven Teyf35942962748
diff --git a/apps/web/app/api/cron/import/bitly/utils.ts b/apps/web/app/api/cron/import/bitly/utils.ts
index cf388b06f0..4ac09ff7b8 100644
--- a/apps/web/app/api/cron/import/bitly/utils.ts
+++ b/apps/web/app/api/cron/import/bitly/utils.ts
@@ -197,16 +197,22 @@ export const importLinksFromBitly = async ({
// than the link that was imported
const caseDuplicates = importedLinks.filter((link) => {
const duplicate = alreadyCreatedLinks.find(
- (l) => l.shortLink === link.shortLink,
+ (l) => l.shortLink.toLowerCase() === link.shortLink.toLowerCase(),
);
return duplicate && duplicate.url !== link.url;
});
if (caseDuplicates.length) {
await log({
- message: `Found potential case duplicates: ${caseDuplicates
- .map((c) => `${c.shortLink} - ${c.url}`)
- .join(", ")}`,
+ message: `Found potential case duplicates:\n${caseDuplicates
+ .map((c) => {
+ const existing = alreadyCreatedLinks.find(
+ (l) =>
+ l.shortLink.toLowerCase() === c.shortLink.toLowerCase(),
+ );
+ return `\nImported: ${c.shortLink} → ${c.url}\nExisting: ${existing?.shortLink} → ${existing?.url}`;
+ })
+ .join("\n")}`,
type: "alerts",
mention: true,
});