diff --git a/src/utils/note.ts b/src/utils/note.ts
index 1dfa08a1..b0b075d9 100644
--- a/src/utils/note.ts
+++ b/src/utils/note.ts
@@ -33,10 +33,10 @@ function parseNoteContent(content: string, mentions: MastodonMention[]): ParsedN
return html`#${tag}`;
},
url: ({ attributes, content }) => {
- const { protocol, pathname } = new URL(content);
+ try {
+ const { protocol, pathname } = new URL(content);
- if (protocol === 'nostr:') {
- try {
+ if (protocol === 'nostr:') {
const match = pathname.match(new RegExp(`^${nip19.BECH32_REGEX.source}`));
if (match) {
const bech32 = match[0];
@@ -52,10 +52,10 @@ function parseNoteContent(content: string, mentions: MastodonMention[]): ParsedN
return html`@${name}${extra}`;
}
}
- } catch {
- // fallthrough
}
return content;
+ } catch {
+ // fallthrough
}
const attr = Object.entries(attributes)