From 22ea1b382f99280ae3ca2c846564b662ee6988d9 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Mon, 18 May 2020 18:09:18 -0400 Subject: [PATCH] be more specific about attachment mediatype lookup --- activity.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/activity.go b/activity.go index 973c0e5..c1b9713 100644 --- a/activity.go +++ b/activity.go @@ -730,10 +730,16 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk { 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 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk { 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" ||