From f8fae52d5e083a4676989ef1604f57d38c88adb3 Mon Sep 17 00:00:00 2001 From: Siddharth Singh Date: Sun, 25 Aug 2024 19:13:31 +0530 Subject: [PATCH] fix bug in alt text tagging --- src/views/mastodon/attachments.ts | 2 +- src/views/mastodon/statuses.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/views/mastodon/attachments.ts b/src/views/mastodon/attachments.ts index 9307ea8..9320f60 100644 --- a/src/views/mastodon/attachments.ts +++ b/src/views/mastodon/attachments.ts @@ -10,7 +10,7 @@ function renderAttachment( const url = tags.find(([name]) => name === 'url')?.[1]; const m = tags.find(([name]) => name === 'm')?.[1] ?? getUrlMediaType(url!); - const alt = tags.find(([name]) => name === 'alt')?.slice(1).join(' '); + const alt = tags.find(([name]) => name === 'alt')?.[1]; const cid = tags.find(([name]) => name === 'cid')?.[1]; const dim = tags.find(([name]) => name === 'dim')?.[1]; const blurhash = tags.find(([name]) => name === 'blurhash')?.[1]; diff --git a/src/views/mastodon/statuses.ts b/src/views/mastodon/statuses.ts index d1c02f1..bc42765 100644 --- a/src/views/mastodon/statuses.ts +++ b/src/views/mastodon/statuses.ts @@ -84,7 +84,12 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise< const imeta: string[][][] = event.tags .filter(([name]) => name === 'imeta') - .map(([_, ...entries]) => entries.map((entry) => entry.split(' '))); + .map(([_, ...entries]) => + entries.map((entry) => { + const split = entry.split(' '); + return [split[0], split.splice(1).join(' ')]; + }) + ); const media = imeta.length ? imeta : getMediaLinks(links);