aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/mail.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--internal/feed/mail.go20
1 files changed, 17 insertions, 3 deletions
diff --git a/internal/feed/mail.go b/internal/feed/mail.go
index b6cd231..f5863a6 100644
--- a/internal/feed/mail.go
+++ b/internal/feed/mail.go
@@ -123,10 +123,19 @@ func (item *Item) writeHtmlPart(w *message.Writer) error {
return item.writeContentPart(w, "html", template.Html)
}
+func (img *feedImage) buildNameMap(key string) map[string]string {
+ if img.name == "" {
+ return nil
+ }
+ return map[string]string{key: img.name}
+}
+
func (img *feedImage) writeImagePart(w *message.Writer, cid string) error {
var ih message.Header
- ih.SetContentType(img.mime, nil)
- ih.SetContentDisposition("inline", nil)
+ // set filename for both Type and Disposition
+ // according to standard, it belongs to the latter -- but some clients expect the former
+ ih.SetContentType(img.mime, img.buildNameMap("name"))
+ ih.SetContentDisposition("inline", img.buildNameMap("filename"))
ih.Set("Content-Transfer-Encoding", "base64")
ih.SetText("Content-ID", fmt.Sprintf("<%s>", cid))
@@ -288,7 +297,12 @@ func (item *Item) downloadImage(src string) string {
if feed.EmbedImages {
return "data:" + mime + ";base64," + base64.StdEncoding.EncodeToString(img)
} else {
- idx := item.addImage(img, mime)
+ name := path.Base(src)
+ if name == "/" || name == "." || name == " " {
+ name = ""
+ }
+
+ idx := item.addImage(img, mime, name)
return "cid:" + cidNr(idx)
}
}
b4a79&follow=1'>Fix vettingRené 'Necoro' Neumann1-1/+1 2020-04-20Started with mail creationRené 'Necoro' Neumann4-3/+126 2020-04-20FeeditemsRené 'Necoro' Neumann2-2/+14 2020-04-20GlobalOptionsRené 'Necoro' Neumann3-25/+79 2020-04-19RestructureRené 'Necoro' Neumann6-152/+177 2020-04-19Rename package 'parse' to 'feed'René 'Necoro' Neumann2-3/+3 2020-04-19SELECT is not necessary for most operations -- skip itRené 'Necoro' Neumann2-12/+1 2020-04-19Store path as array -- the delimiter is not always '.'René 'Necoro' Neumann3-36/+44 2020-04-19Split client part to client.goRené 'Necoro' Neumann2-125/+137 2020-04-19IMAP: Create foldersRené 'Necoro' Neumann1-4/+38 2020-04-19Improved IMAPRené 'Necoro' Neumann1-3/+88 2020-04-19Started IMAP connectionRené 'Necoro' Neumann4-0/+152 2020-04-19Use our own logger for debug for convenience sakeRené 'Necoro' Neumann1-2/+3 2020-04-19Fix debug logging m(René 'Necoro' Neumann1-2/+2 2020-04-19Rename util.go to log.go. Add verbose modeRené 'Necoro' Neumann4-24/+54 2020-04-19Clean go.modRené 'Necoro' Neumann2-3/+0 2020-04-19Do not print the parsedCfg anymoreRené 'Necoro' Neumann1-1/+1 2020-04-19Increase go-version to 1.14René 'Necoro' Neumann1-2/+2 2020-04-19CI: go vetRené 'Necoro' Neumann1-0/+3 2020-04-19Fetching and parsing the feedsRené 'Necoro' Neumann5-4/+113 2020-04-19Ignore all config*.ymlRené 'Necoro' Neumann1-1/+1