aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/routes.go8
-rw-r--r--plugins/base/template.go8
2 files changed, 7 insertions, 9 deletions
diff --git a/plugins/base/routes.go b/plugins/base/routes.go
index 321303d..f426c96 100644
--- a/plugins/base/routes.go
+++ b/plugins/base/routes.go
@@ -181,7 +181,7 @@ func newIMAPBaseRenderData(ctx *alps.Context,
var categorized CategorizedMailboxes
- for i, _ := range mailboxes {
+ for i := range mailboxes {
// Populate unseen & active states
if active != nil && mailboxes[i].Name == active.Name {
mailboxes[i].Unseen = int(active.Unseen)
@@ -403,6 +403,9 @@ type MessageRenderData struct {
func handleGetPart(ctx *alps.Context, raw bool) error {
_, uid, err := parseMboxAndUid(ctx.Param("mbox"), ctx.Param("uid"))
+ if err != nil {
+ return err
+ }
ibase, err := newIMAPBaseRenderData(ctx, alps.NewBaseRenderData(ctx))
if err != nil {
return err
@@ -468,9 +471,8 @@ func handleGetPart(ctx *alps.Context, raw bool) error {
if len(partPath) == 0 {
return part.WriteTo(ctx.Response())
- } else {
- return ctx.Stream(http.StatusOK, mimeType, part.Body)
}
+ return ctx.Stream(http.StatusOK, mimeType, part.Body)
}
view, err := viewMessagePart(ctx, msg, part)
diff --git a/plugins/base/template.go b/plugins/base/template.go
index 7d6e126..45ba7bf 100644
--- a/plugins/base/template.go
+++ b/plugins/base/template.go
@@ -19,9 +19,7 @@ var templateFuncs = template.FuncMap{
"tuple": func(values ...interface{}) []interface{} {
return values
},
- "pathescape": func(s string) string {
- return url.PathEscape(s)
- },
+ "pathescape": url.PathEscape,
"formatdate": func(t time.Time) string {
return t.Format("Mon Jan 02 15:04")
},
@@ -47,9 +45,7 @@ var templateFuncs = template.FuncMap{
return true
}
},
- "join": func(l []string, sep string) string {
- return strings.Join(l, sep)
- },
+ "join": strings.Join,
"formatinputdate": func(t time.Time) string {
if t.IsZero() {
return ""