save federated pdfs

This commit is contained in:
Ted Unangst 2019-11-26 02:32:23 -05:00
parent e5e3c8b6a7
commit 97e84447c3
1 changed files with 8 additions and 1 deletions

View File

@ -199,6 +199,12 @@ func savedonk(url string, name, desc, media string, localize bool) *Donk {
format = "jpg" format = "jpg"
} }
xid = xid + "." + format xid = xid + "." + format
} else if media == "application/pdf" {
if len(data) > 1000000 {
log.Printf("not saving large pdf")
localize = false
data = []byte{}
}
} else if len(data) > 100000 { } else if len(data) > 100000 {
log.Printf("not saving large attachment") log.Printf("not saving large attachment")
localize = false localize = false
@ -709,7 +715,8 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
} else if at == "Document" || at == "Image" { } else if 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 == "text/plain" || strings.HasPrefix(mt, "image") { if mt == "text/plain" || mt == "application/pdf" ||
strings.HasPrefix(mt, "image") {
localize = true localize = true
} }
} else { } else {