From 5acf6ef5cece489cab39e953eeb92043d4fa3656 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Fri, 15 May 2020 00:18:40 -0400 Subject: [PATCH] more robust parsing of attachment json --- activity.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/activity.go b/activity.go index f6c9967..905af10 100644 --- a/activity.go +++ b/activity.go @@ -725,7 +725,14 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk { mt, _ := att.GetString("mediaType") u, ok := att.GetString("url") if !ok { - if uu, ok := att.GetMap("url"); ok { + if ua, ok := att.GetArray("url"); ok && len(ua) > 0 { + u, ok = ua[0].(string) + if !ok { + if uu, ok := ua[0].(junk.Junk); ok { + u, _ = uu.GetString("href") + } + } + } else if uu, ok := att.GetMap("url"); ok { u, _ = uu.GetString("href") } }