From daa3df13ada782f7c447ff5e1d4fc92eccf92393 Mon Sep 17 00:00:00 2001 From: grassblock Date: Fri, 15 Aug 2025 17:45:30 +0800 Subject: [PATCH] fix: author default avatar path returns 404 --- src/pages/images/avatars/[author].png.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/pages/images/avatars/[author].png.js b/src/pages/images/avatars/[author].png.js index df69c22..b449d56 100644 --- a/src/pages/images/avatars/[author].png.js +++ b/src/pages/images/avatars/[author].png.js @@ -66,7 +66,7 @@ async function cacheAvatar(cacheKey, data) { } function addToMemoryCache(key, data) { - // If cache is full, remove oldest entry + // If cache is full, remove the oldest entry if (AVATAR_CACHE.size >= CACHE_MAX_SIZE) { const oldestKey = AVATAR_CACHE.keys().next().value; AVATAR_CACHE.delete(oldestKey); @@ -80,10 +80,12 @@ function addToMemoryCache(key, data) { export async function getStaticPaths() { const authorsData = await getCollection('authors'); - return authorsData.map(author => ({ - params: { author: author.id }, - props: { author } - })); + return authorsData + .filter(author => author.data.mcplayerid) // Only include authors with mcplayerid + .map(author => ({ + params: { author: author.data.mcplayerid }, + props: { author } + })); } export async function GET({ props }) {