Skip to content

Commit ba38b21

Browse files
committed
fix: skip blog generation for missed avatars
1 parent 7bbff92 commit ba38b21

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

modules/blog.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ async function fetchBlueskyAvatars(
5555

5656
if (!existsSync(dest)) {
5757
const res = await fetch(`${profile.avatar}@png`)
58-
await writeFile(join(imagesDir, `${hash}.png`), res.body!)
58+
if (!res.ok || !res.body) {
59+
console.warn(`[blog] Failed to fetch Bluesky avatar: ${profile.avatar}@png`)
60+
continue
61+
}
62+
await writeFile(join(imagesDir, `${hash}.png`), res.body)
5963
}
6064

6165
avatarMap.set(profile.handle, `/blog/avatar/${hash}.png`)

0 commit comments

Comments
 (0)