From 97e84447c3704cefebbaaaf719214b57e5fbfc92 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 26 Nov 2019 02:32:23 -0500 Subject: [PATCH] save federated pdfs --- activity.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/activity.go b/activity.go index e62a050..d7accfe 100644 --- a/activity.go +++ b/activity.go @@ -199,6 +199,12 @@ func savedonk(url string, name, desc, media string, localize bool) *Donk { 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 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk { } 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 {