From 976a5cd67a91e6eed9900a65bc2800c719fed476 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Mon, 25 Nov 2024 13:13:15 +0800 Subject: [PATCH] fix: empty metadata --- src/lib/expand-unit.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/expand-unit.ts b/src/lib/expand-unit.ts index eb776a6c63..2b30fd82f6 100644 --- a/src/lib/expand-unit.ts +++ b/src/lib/expand-unit.ts @@ -244,6 +244,11 @@ export const expandCrossbellNote = async ({ } export const expandCrossbellCharacter = async (site: CharacterEntity) => { + if (!site.metadata && site.uri) { + site.metadata = { + uri: site.uri, + } + } if (site.metadata?.uri && !site.metadata?.content) { site.metadata.content = await ( await fetch(toGateway(site.metadata.uri)) @@ -258,6 +263,11 @@ export const expandCrossbellCharacter = async (site: CharacterEntity) => { }, site, ) + if (!expandedCharacter.metadata) { + expandedCharacter.metadata = { + content: {}, + } + } if (!expandedCharacter.metadata.content) { expandedCharacter.metadata.content = {} }