From cfa684892770f73da2013d90d8de48d9936afd9d Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 3 Feb 2025 14:53:38 -0600 Subject: [PATCH] Only parse mentions with valid pubkeys Fixes https://gitlab.com/soapbox-pub/ditto/-/issues/290 --- src/views/mastodon/statuses.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/mastodon/statuses.ts b/src/views/mastodon/statuses.ts index 3f8f1c96..265cf442 100644 --- a/src/views/mastodon/statuses.ts +++ b/src/views/mastodon/statuses.ts @@ -7,7 +7,7 @@ import { MastodonMention } from '@/entities/MastodonMention.ts'; import { MastodonStatus } from '@/entities/MastodonStatus.ts'; import { type DittoEvent } from '@/interfaces/DittoEvent.ts'; import { Storages } from '@/storages.ts'; -import { nostrDate } from '@/utils.ts'; +import { isNostrId, nostrDate } from '@/utils.ts'; import { getMediaLinks, parseNoteContent, stripimeta } from '@/utils/note.ts'; import { findReplyTag } from '@/utils/tags.ts'; import { unfurlCardCached } from '@/utils/unfurl.ts'; @@ -41,8 +41,8 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise< const mentionedPubkeys = [ ...new Set( event.tags - .filter((tag) => tag[0] === 'p') - .map((tag) => tag[1]), + .filter(([name, value]) => name === 'p' && isNostrId(value)) + .map(([, value]) => value), ), ];