all repos — honk @ 1e9e2903ee1a7400e4a54586afc12a9e593ba215

my fork of honk

save federated pdfs
Ted Unangst tedu@tedunangst.com
Tue, 26 Nov 2019 02:32:23 -0500
commit

1e9e2903ee1a7400e4a54586afc12a9e593ba215

parent

178f6edfc04751ec78e13a3f95a8ac94735c6b15

1 files changed, 8 insertions(+), 1 deletions(-)

jump to
M activity.goactivity.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 {