From 92b1c61dc1de616562ce4356b3c75fe6a06b22b8 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sat, 29 Jul 2023 15:04:11 -0400 Subject: [PATCH] handle the case where the tag is just an object --- activity.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/activity.go b/activity.go index 37ef878..237602b 100644 --- a/activity.go +++ b/activity.go @@ -967,12 +967,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk { procatt(att) } } - tags, _ := obj.GetArray("tag") - for _, tagi := range tags { - tag, ok := tagi.(junk.Junk) - if !ok { - continue - } + proctag := func(tag junk.Junk) { tt, _ := tag.GetString("type") name, _ := tag.GetString("name") desc, _ := tag.GetString("summary") @@ -1017,6 +1012,18 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk { mentions = append(mentions, m) } } + tags, _ := obj.GetArray("tag") + for _, tagi := range tags { + tag, ok := tagi.(junk.Junk) + if !ok { + continue + } + proctag(tag) + } + tag, ok := obj.GetMap("tag") + if ok { + proctag(tag) + } if starttime, ok := obj.GetString("startTime"); ok { if start, err := time.Parse(time.RFC3339, starttime); err == nil { t := new(Time)