From 2d923feda28d585033a586458a6f5162269fc80c Mon Sep 17 00:00:00 2001 From: mr0x50 <24775431+mroxso@users.noreply.github.com> Date: Sat, 15 Feb 2025 21:02:03 +0100 Subject: [PATCH] do not display a kind20 note if image does not start with "http" to prevent non-url errors --- components/KIND20Card.tsx | 4 ++-- components/QuickViewKind20NoteCard.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/KIND20Card.tsx b/components/KIND20Card.tsx index c9dbd96..9b9ea56 100644 --- a/components/KIND20Card.tsx +++ b/components/KIND20Card.tsx @@ -39,8 +39,8 @@ const KIND20Card: React.FC = ({ }) const [imageError, setImageError] = useState(false); - if (!image || imageError) return null; - + if (!image || !image.startsWith("http") || imageError) return null; + const title = userData?.username || userData?.display_name || userData?.name || userData?.npub || nip19.npubEncode(pubkey) text = text.replaceAll("\n", " ") diff --git a/components/QuickViewKind20NoteCard.tsx b/components/QuickViewKind20NoteCard.tsx index d288c4c..292e409 100644 --- a/components/QuickViewKind20NoteCard.tsx +++ b/components/QuickViewKind20NoteCard.tsx @@ -27,7 +27,7 @@ const QuickViewKind20NoteCard: React.FC = ({ pubke }); const [imageError, setImageError] = useState(false); - if (!image || imageError) return null; + if (!image || !image.startsWith("http") || imageError) return null; text = text.replaceAll('\n', ' '); const encodedNoteId = nip19.noteEncode(event.id)