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.

final tweaks

Steven Tey8a364456cbcf
diff --git a/apps/web/app/api/domains/[domain]/route.ts b/apps/web/app/api/domains/[domain]/route.ts
index adeb428ef3..cd5fad7b7e 100644
--- a/apps/web/app/api/domains/[domain]/route.ts
+++ b/apps/web/app/api/domains/[domain]/route.ts
@@ -119,7 +119,7 @@ export const PATCH = withWorkspace(
...(placeholder && { placeholder }),
expiredUrl,
notFoundUrl,
- logo: deleteLogo ? null : logoUploaded?.url,
+ logo: deleteLogo ? null : logoUploaded?.url || oldLogo,
},
include: {
registeredDomain: true,
diff --git a/apps/web/lib/api/domains/delete-domain-links.ts b/apps/web/lib/api/domains/delete-domain-links.ts
index 7390a97672..ec9f70cd18 100644
--- a/apps/web/lib/api/domains/delete-domain-links.ts
+++ b/apps/web/lib/api/domains/delete-domain-links.ts
@@ -16,6 +16,7 @@ export async function deleteDomainAndLinks(domain: string) {
select: {
id: true,
projectId: true,
+ logo: true,
createdAt: true,
},
}),
@@ -76,6 +77,9 @@ export async function deleteDomainAndLinks(domain: string) {
}),
// remove the domain from Vercel
removeDomainFromVercel(domain),
+ // if domain has logo, delete it from R2
+ domainData.logo &&
+ storage.delete(domainData.logo.replace(`${R2_URL}/`, "")),
]);
})(),
);