all repos — honk @ 1e53f94620a8e0142b842bac9cfc113f5d90b7e3

my fork of honk

more robust parsing of attachment json
Ted Unangst tedu@tedunangst.com
Fri, 15 May 2020 00:18:40 -0400
commit

1e53f94620a8e0142b842bac9cfc113f5d90b7e3

parent

738e98627cfb7447e09f6ded55d662d2513bf98a

1 files changed, 8 insertions(+), 1 deletions(-)

jump to
M activity.goactivity.go

@@ -725,7 +725,14 @@ at, _ := att.GetString("type")

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") } }