more than 4 attachments seems execessive, leave the rest off.

This commit is contained in:
Ted Unangst 2019-05-01 23:13:00 -04:00
parent 43971e9fb7
commit 64d9c67c35
1 changed files with 2 additions and 2 deletions

View File

@ -518,12 +518,12 @@ func xonkxonk(user *WhatAbout, item interface{}) *Honk {
rid, _ = jsongetstring(obj, "id") rid, _ = jsongetstring(obj, "id")
} }
atts, _ := jsongetarray(obj, "attachment") atts, _ := jsongetarray(obj, "attachment")
for _, att := range atts { for i, att := range atts {
at, _ := jsongetstring(att, "type") at, _ := jsongetstring(att, "type")
mt, _ := jsongetstring(att, "mediaType") mt, _ := jsongetstring(att, "mediaType")
u, _ := jsongetstring(att, "url") u, _ := jsongetstring(att, "url")
name, _ := jsongetstring(att, "name") name, _ := jsongetstring(att, "name")
if at == "Document" || at == "Image" { if i < 4 && (at == "Document" || at == "Image") {
mt = strings.ToLower(mt) mt = strings.ToLower(mt)
log.Printf("attachment: %s %s", mt, u) log.Printf("attachment: %s %s", mt, u)
if mt == "image/jpeg" || mt == "image/png" || if mt == "image/jpeg" || mt == "image/png" ||