be more specific about attachment mediatype lookup
Ted Unangst tedu@tedunangst.com
Mon, 18 May 2020 18:09:18 -0400
1 files changed,
6 insertions(+),
4 deletions(-)
jump to
M
activity.go
→
activity.go
@@ -730,10 +730,16 @@ u, ok = ua[0].(string)
if !ok { if uu, ok := ua[0].(junk.Junk); ok { u, _ = uu.GetString("href") + if mt == "" { + mt, _ = uu.GetString("mediaType") + } } } } else if uu, ok := att.GetMap("url"); ok { u, _ = uu.GetString("href") + if mt == "" { + mt, _ = uu.GetString("mediaType") + } } } name, _ := att.GetString("name")@@ -745,10 +751,6 @@ localize := false
if numatts > 4 { log.Printf("excessive attachment: %s", at) } else if at == "Document" || at == "Image" { - if mt == "" { - log.Printf("assuming image media") - mt = "image/jpeg" - } mt = strings.ToLower(mt) log.Printf("attachment: %s %s", mt, u) if mt == "text/plain" || mt == "application/pdf" ||