From 6ac4c072a6caeb9216c9c818e53e70d1249d69eb Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 18 May 2024 08:20:43 -0500 Subject: [PATCH] Fix crash decoding url --- src/note.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/note.ts b/src/note.ts index 5603c539..1c5c70cd 100644 --- a/src/note.ts +++ b/src/note.ts @@ -18,7 +18,7 @@ const linkifyOpts: linkify.Opts = { return `#${tag}`; }, url: ({ content }) => { - if (nip21.test(content)) { + try { const { decoded } = nip21.parse(content); const pubkey = getDecodedPubkey(decoded); if (pubkey) { @@ -28,7 +28,7 @@ const linkifyOpts: linkify.Opts = { } else { return ''; } - } else { + } catch { return `${content}`; } },