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}`;
}
},