@@ -51,14 +51,18 @@ async function fetchBlueskyAvatars(
5151 for ( const profile of data . profiles ) {
5252 if ( profile . avatar ) {
5353 const hash = crypto . createHash ( 'sha256' ) . update ( profile . avatar ) . digest ( 'hex' )
54- const dest = join ( imagesDir , `${ hash } .jpg ` )
54+ const dest = join ( imagesDir , `${ hash } .png ` )
5555
5656 if ( ! existsSync ( dest ) ) {
57- const res = await fetch ( profile . avatar )
58- await writeFile ( join ( imagesDir , `${ hash } .jpg` ) , res . body ! )
57+ const res = await fetch ( `${ profile . avatar } @png` )
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
61- avatarMap . set ( profile . handle , `/blog/avatar/${ hash } .jpg ` )
65+ avatarMap . set ( profile . handle , `/blog/avatar/${ hash } .png ` )
6266 }
6367 }
6468 } catch ( error ) {
@@ -85,7 +89,7 @@ function resolveAuthors(authors: Author[], avatarMap: Map<string, string>): Reso
8589 * Resolves Bluesky avatars at build time.
8690 */
8791async function loadBlogPosts ( blogDir : string , imagesDir : string ) : Promise < BlogPostFrontmatter [ ] > {
88- const files : string [ ] = globSync ( join ( blogDir , '*.md' ) )
92+ const files : string [ ] = globSync ( join ( blogDir , '*.md' ) . replace ( / \\ / g , '/' ) )
8993
9094 // First pass: extract raw frontmatter and collect all Bluesky handles
9195 const rawPosts : Array < { frontmatter : Record < string , unknown > } > = [ ]
0 commit comments