From d325628cb2b0ad49790549367d1f792fc0f4735e Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 30 Oct 2020 10:23:57 -0400 Subject: compose: don't fail on 0 attachments --- plugins/base/routes.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/base/routes.go b/plugins/base/routes.go index c9df564..ce72255 100644 --- a/plugins/base/routes.go +++ b/plugins/base/routes.go @@ -546,9 +546,13 @@ func handleCompose(ctx *alps.Context, msg *OutgoingMessage, options *composeOpti uuids := ctx.FormValue("attachment-uuids") for _, uuid := range strings.Split(uuids, ",") { + if uuid == "" { + continue + } + attachment := ctx.Session.PopAttachment(uuid) if attachment == nil { - return fmt.Errorf("Unable to retrieve message attachments from session") + return fmt.Errorf("Unable to retrieve message attachment %s from session", uuid) } msg.Attachments = append(msg.Attachments, &refcountedAttachment{ attachment.File, -- cgit v1.2.3