From 364e7a0b80f715362228fc57af32432b285b034c Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Mon, 21 Nov 2016 22:32:29 -0800 Subject: [PATCH] Track enmime API changes - Part accessors: https://github.com/jhillyerd/enmime/commit/196b2ad725f84bf8b2847ac85d9b37c9486e8b7a - IsTextFromHTML: https://github.com/jhillyerd/enmime/commit/2bd44ac6cc742fd5bd30eee9d267f965de928f55 --- themes/bootstrap/templates/mailbox/_show.html | 10 +++++++--- webui/mailbox_controller.go | 16 ++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/themes/bootstrap/templates/mailbox/_show.html b/themes/bootstrap/templates/mailbox/_show.html index 474e0cf..33a9975 100644 --- a/themes/bootstrap/templates/mailbox/_show.html +++ b/themes/bootstrap/templates/mailbox/_show.html @@ -67,10 +67,14 @@ -{{if .isTextFromHTML}} +{{with .mimeErrors}} {{end}} diff --git a/webui/mailbox_controller.go b/webui/mailbox_controller.go index cadb226..de56540 100644 --- a/webui/mailbox_controller.go +++ b/webui/mailbox_controller.go @@ -180,13 +180,13 @@ func MailboxShow(w http.ResponseWriter, req *http.Request, ctx *httpd.Context) ( htmlAvailable := mime.HTML != "" return httpd.RenderPartial("mailbox/_show.html", w, map[string]interface{}{ - "ctx": ctx, - "name": name, - "message": msg, - "body": body, - "htmlAvailable": htmlAvailable, - "isTextFromHTML": mime.IsTextFromHTML, - "attachments": mime.Attachments, + "ctx": ctx, + "name": name, + "message": msg, + "body": body, + "htmlAvailable": htmlAvailable, + "mimeErrors": mime.Errors, + "attachments": mime.Attachments, }) } @@ -386,7 +386,7 @@ func MailboxViewAttach(w http.ResponseWriter, req *http.Request, ctx *httpd.Cont } part := body.Attachments[num] - w.Header().Set("Content-Type", part.ContentType()) + w.Header().Set("Content-Type", part.ContentType) if _, err := io.Copy(w, part); err != nil { return err }