fix(patreon): fix empty image (#18419)

This commit is contained in:
Tony 2025-02-21 09:58:05 +08:00 committed by GitHub
parent cfe58ca805
commit f6cb490fc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -98,7 +98,7 @@ async function handler(ctx) {
}
}
if (attributes.video_preview) {
relationships.video_preview = posts.included.find((i) => Number.parseInt(i.id) === attributes.video_preview.media_id) as unknown as MediaRelation;
relationships.video_preview = posts.included.find((i) => Number.parseInt(i.id) === attributes.video_preview?.media_id) as unknown as MediaRelation;
}
return {
@ -110,7 +110,7 @@ async function handler(ctx) {
}),
link: attributes.url,
pubDate: parseDate(attributes.published_at),
image: attributes.thumbnail?.url ?? attributes.image.url,
image: attributes.thumbnail?.url ?? attributes.image?.url,
category: relationships.user_defined_tags?.map((tag) => tag.attributes.value),
};
});

View File

@ -23,6 +23,8 @@
{{ else if attributes.post_type === 'video_embed' || attributes.post_type === 'link' }}
<img src="{{ attributes.image.url }}"><br>
{{ else if attributes.post_type === 'text_only' }}
{{ else }}
Post type: "{{ attributes.post_type }}" is not supported. <br>