Filter out attachments with no url
This commit is contained in:
parent
e7d350a0e3
commit
91ea4577f1
|
@ -12,8 +12,10 @@ function renderAttachment(tags: string[][]) {
|
||||||
const uuid = tags.find(([name]) => name === 'uuid')?.[1];
|
const uuid = tags.find(([name]) => name === 'uuid')?.[1];
|
||||||
const blurhash = tags.find(([name]) => name === 'blurhash')?.[1];
|
const blurhash = tags.find(([name]) => name === 'blurhash')?.[1];
|
||||||
|
|
||||||
|
if (!url) return;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: uuid,
|
id: uuid ?? url,
|
||||||
type: getAttachmentType(m ?? ''),
|
type: getAttachmentType(m ?? ''),
|
||||||
url,
|
url,
|
||||||
preview_url: url,
|
preview_url: url,
|
||||||
|
|
|
@ -106,7 +106,7 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise<
|
||||||
pinned: Boolean(pinEvent),
|
pinned: Boolean(pinEvent),
|
||||||
reblog: null,
|
reblog: null,
|
||||||
application: null,
|
application: null,
|
||||||
media_attachments: media.map(renderAttachment),
|
media_attachments: media.map(renderAttachment).filter(Boolean),
|
||||||
mentions,
|
mentions,
|
||||||
tags: [],
|
tags: [],
|
||||||
emojis: renderEmojis(event),
|
emojis: renderEmojis(event),
|
||||||
|
|
Loading…
Reference in New Issue