The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix logic
Steven Tey655a01bb140d
diff --git a/apps/web/lib/api/links/bulk-update-links.ts b/apps/web/lib/api/links/bulk-update-links.tsindex 5c47b76fee..3ff288d016 100644--- a/apps/web/lib/api/links/bulk-update-links.ts+++ b/apps/web/lib/api/links/bulk-update-links.ts@@ -50,7 +50,7 @@ export async function bulkUpdateLinks(title: truncate(title, 120),description: truncate(description, 240),image:- proxy && image && !isNotHostedImage(image)+ proxy && image && isNotHostedImage(image)? `${R2_URL}/images/${linkIds[0]}_${imageUrlNonce}`: image,expiresAt: expiresAt ? new Date(expiresAt) : null,@@ -129,7 +129,7 @@ export async function bulkUpdateLinks(// if proxy is true and image is not stored in R2, upload image to R2proxy &&image &&- !isNotHostedImage(image) &&+ isNotHostedImage(image) &&storage.upload(`images/${linkIds[0]}_${imageUrlNonce}`, image, {width: 1200,height: 630,diff --git a/apps/web/lib/api/links/create-link.ts b/apps/web/lib/api/links/create-link.tsindex 555f945746..b90b95f153 100644--- a/apps/web/lib/api/links/create-link.ts+++ b/apps/web/lib/api/links/create-link.ts@@ -60,7 +60,7 @@ export async function createLink(link: ProcessedLinkProps) {title: truncate(title, 120),description: truncate(description, 240),// if it's an uploaded image, make this null first because we'll update it later- image: proxy && image && !isNotHostedImage(image) ? null : image,+ image: proxy && image && isNotHostedImage(image) ? null : image,utm_source,utm_medium,utm_campaign,@@ -151,7 +151,7 @@ export async function createLink(link: ProcessedLinkProps) {recordLink(response),// Upload image to R2 and update the link with the uploaded image URL when// proxy is enabled and image is set and is not a hosted image URL- ...(proxy && image && !isNotHostedImage(image)+ ...(proxy && image && isNotHostedImage(image)? [// upload image to R2storage.upload(`images/${response.id}`, image, {@@ -199,7 +199,7 @@ export async function createLink(link: ProcessedLinkProps) {...transformLink(response),// optimistically set the image URL to the uploaded image URLimage:- proxy && image && !isNotHostedImage(image)+ proxy && image && isNotHostedImage(image)? uploadedImageUrl: response.image,};diff --git a/apps/web/lib/api/links/update-link.ts b/apps/web/lib/api/links/update-link.tsindex 87d5e306ae..90e0e68123 100644--- a/apps/web/lib/api/links/update-link.ts+++ b/apps/web/lib/api/links/update-link.ts@@ -93,7 +93,7 @@ export async function updateLink({title: truncate(title, 120),description: truncate(description, 240),image:- proxy && image && !isNotHostedImage(image)+ proxy && image && isNotHostedImage(image)? `${R2_URL}/images/${id}_${imageUrlNonce}`: image,utm_source: utm_source || null,@@ -188,7 +188,7 @@ export async function updateLink({// if proxy is true and image is not stored in R2, upload image to R2proxy &&image &&- !isNotHostedImage(image) &&+ isNotHostedImage(image) &&storage.upload(`images/${id}_${imageUrlNonce}`, image, {width: 1200,height: 630,