aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/base/routes.go
diff options
context:
space:
mode:
authorLibravatarLibravatar Simon Ser <[email protected]> 2020-01-08 14:30:00 +0100
committerLibravatarLibravatar Simon Ser <[email protected]> 2020-01-20 16:20:16 +0100
commita66ef1059b29946e62fc1da7175109a386985ee7 (patch)
tree4e1ae04a163ce3cd2dde126c1cb9995bc20641ac /plugins/base/routes.go
parent8d248bc32fa18e4bc9c26fabf603fdaadc45963c (diff)
downloadalps-a66ef1059b29946e62fc1da7175109a386985ee7.tar.gz
alps-a66ef1059b29946e62fc1da7175109a386985ee7.tar.bz2
alps-a66ef1059b29946e62fc1da7175109a386985ee7.zip
Make the text/* part content a []byte
Diffstat (limited to 'plugins/base/routes.go')
-rw-r--r--plugins/base/routes.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/plugins/base/routes.go b/plugins/base/routes.go
index 798615f..9232097 100644
--- a/plugins/base/routes.go
+++ b/plugins/base/routes.go
@@ -234,13 +234,12 @@ func handleGetPart(ctx *koushin.Context, raw bool) error {
}
}
- var body string
+ var body []byte
if strings.HasPrefix(strings.ToLower(mimeType), "text/") {
- b, err := ioutil.ReadAll(part.Body)
+ body, err = ioutil.ReadAll(part.Body)
if err != nil {
return fmt.Errorf("failed to read part body: %v", err)
}
- body = string(b)
}
isHTML := false
@@ -263,7 +262,7 @@ func handleGetPart(ctx *koushin.Context, raw bool) error {
Mailboxes: mailboxes,
Mailbox: mbox,
Message: msg,
- Body: body,
+ Body: string(body),
IsHTML: isHTML,
PartPath: partPathString,
MailboxPage: int(mbox.Messages-msg.SeqNum) / messagesPerPage,