fix: author default avatar path returns 404

This commit is contained in:
草师傅 2025-08-15 17:45:30 +08:00
parent 112f76dae1
commit daa3df13ad
Signed by: gb
GPG key ID: 43330A030E2D6478

View file

@ -66,7 +66,7 @@ async function cacheAvatar(cacheKey, data) {
} }
function addToMemoryCache(key, 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) { if (AVATAR_CACHE.size >= CACHE_MAX_SIZE) {
const oldestKey = AVATAR_CACHE.keys().next().value; const oldestKey = AVATAR_CACHE.keys().next().value;
AVATAR_CACHE.delete(oldestKey); AVATAR_CACHE.delete(oldestKey);
@ -80,10 +80,12 @@ function addToMemoryCache(key, data) {
export async function getStaticPaths() { export async function getStaticPaths() {
const authorsData = await getCollection('authors'); const authorsData = await getCollection('authors');
return authorsData.map(author => ({ return authorsData
params: { author: author.id }, .filter(author => author.data.mcplayerid) // Only include authors with mcplayerid
props: { author } .map(author => ({
})); params: { author: author.data.mcplayerid },
props: { author }
}));
} }
export async function GET({ props }) { export async function GET({ props }) {