fallback to empty metadata when not found.

This commit is contained in:
fiatjaf
2023-11-17 13:11:26 -03:00
parent 8f687f0dc1
commit f269fcbfe9

View File

@@ -371,7 +371,9 @@ func grabData(ctx context.Context, code string, isProfileSitemap bool) (*Data, e
author, relays, _ := getEvent(ctx, data.npub, relaysForNip19)
if author != nil {
data.metadata, _ = sdk.ParseMetadata(author)
if data.metadata != nil {
if data.metadata == nil {
data.metadata = &sdk.ProfileMetadata{PubKey: data.event.PubKey}
} else {
data.authorLong = fmt.Sprintf("%s (%s)", data.metadata.Name, data.npub)
data.authorShort = fmt.Sprintf("%s (%s)", data.metadata.Name, data.npubShort)
}