fix bug in alt text tagging

This commit is contained in:
Siddharth Singh 2024-08-25 19:13:31 +05:30
parent 1f04a7fcdf
commit f8fae52d5e
No known key found for this signature in database
2 changed files with 7 additions and 2 deletions

View file

@ -10,7 +10,7 @@ function renderAttachment(
const url = tags.find(([name]) => name === 'url')?.[1]; const url = tags.find(([name]) => name === 'url')?.[1];
const m = tags.find(([name]) => name === 'm')?.[1] ?? getUrlMediaType(url!); 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 cid = tags.find(([name]) => name === 'cid')?.[1];
const dim = tags.find(([name]) => name === 'dim')?.[1]; const dim = tags.find(([name]) => name === 'dim')?.[1];
const blurhash = tags.find(([name]) => name === 'blurhash')?.[1]; const blurhash = tags.find(([name]) => name === 'blurhash')?.[1];

View file

@ -84,7 +84,12 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise<
const imeta: string[][][] = event.tags const imeta: string[][][] = event.tags
.filter(([name]) => name === 'imeta') .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); const media = imeta.length ? imeta : getMediaLinks(links);