From 4f8ebb95f360454f3dbb6e793932bcd7b1620940 Mon Sep 17 00:00:00 2001 From: Siddharth Singh Date: Tue, 6 Aug 2024 00:26:04 +0530 Subject: [PATCH] hex regex typo fix --- src/controllers/frontend.ts | 2 +- src/utils/og-metadata.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/controllers/frontend.ts b/src/controllers/frontend.ts index 2b5f0152..7adc0926 100644 --- a/src/controllers/frontend.ts +++ b/src/controllers/frontend.ts @@ -39,7 +39,7 @@ async function buildTemplateOpts(params: PathParams, url: string): Promise { + const pubkeyToHandle = async (pubkey: string) => { const fallback = nip19.npubEncode(pubkey).slice(0, 8); try { const author = acc || await fetchProfile({ pubkey }); @@ -120,14 +120,14 @@ export async function getHandle(id: string, acc?: ProfileInfo) { return fallback; }; - if (/[a-z0-9]{64}/.test(id)) { - handle = await handlePubkey(id); + if (/[a-f0-9]{64}/.test(id)) { + handle = await pubkeyToHandle(id); } else if (n.bech32().safeParse(id).success) { if (id.startsWith('npub')) { - handle = await handlePubkey(nip19.decode(id as `npub1${string}`).data); + handle = await pubkeyToHandle(nip19.decode(id as `npub1${string}`).data); } else if (id.startsWith('nprofile')) { const decoded = nip19.decode(id as `nprofile1${string}`).data.pubkey; - handle = await handlePubkey(decoded); + handle = await pubkeyToHandle(decoded); } else { throw new Error('non-nprofile or -npub bech32 passed to getHandle()'); }