aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-10-30 10:23:57 -0400
committerDrew DeVault <sir@cmpwn.com>2020-10-30 10:23:57 -0400
commitd325628cb2b0ad49790549367d1f792fc0f4735e (patch)
tree6dfb97b33baeaf9c95d6d1952e4a043c01a42b5f
parent8bd829962f5879f7994b787199779465afa81a7c (diff)
downloadalps-d325628cb2b0ad49790549367d1f792fc0f4735e.tar.gz
alps-d325628cb2b0ad49790549367d1f792fc0f4735e.zip
compose: don't fail on 0 attachments
-rw-r--r--plugins/base/routes.go6
1 files changed, 5 insertions, 1 deletions
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,