save federated pdfs
Ted Unangst tedu@tedunangst.com
Tue, 26 Nov 2019 02:32:23 -0500
1 files changed,
8 insertions(+),
1 deletions(-)
jump to
M
activity.go
→
activity.go
@@ -199,6 +199,12 @@ if format == "jpeg" {
format = "jpg" } 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 { log.Printf("not saving large attachment") localize = false@@ -709,7 +715,8 @@ log.Printf("excessive attachment: %s", at)
} else if at == "Document" || at == "Image" { mt = strings.ToLower(mt) 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 } } else {