From 135657dbb411401cc55fa9ae10bf741cbe472ced Mon Sep 17 00:00:00 2001 From: "P. Reis" Date: Tue, 13 Aug 2024 17:47:58 -0300 Subject: [PATCH] fix: return undefined in case unfurlCardCached request fails --- src/utils/domains.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/domains.ts b/src/utils/domains.ts index b8697091..799dc029 100644 --- a/src/utils/domains.ts +++ b/src/utils/domains.ts @@ -56,7 +56,12 @@ export const nodeInfoCache = new SimpleLRU( export async function fetchDittoDomain(domain: string): Promise { const total_users = (await nodeInfoCache.fetch(domain)).usage.users.total; - const { title, description, image } = (await unfurlCardCached(`https://${domain}`)) ?? { title: '', description: '' }; + const result = await unfurlCardCached(`https://${domain}`); + if (!result) { + return; + } + + const { title, description, image } = result; return { domain,