From a31bbe369cb6cdb7797a36db411e7c6788219ea7 Mon Sep 17 00:00:00 2001 From: Dan Anglin Date: Thu, 15 Aug 2024 14:13:05 +0100 Subject: [PATCH] use local attachmentIDs variable --- internal/executor/create.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/executor/create.go b/internal/executor/create.go index 96f3c73..ec3dabf 100644 --- a/internal/executor/create.go +++ b/internal/executor/create.go @@ -151,7 +151,9 @@ func (c *CreateExecutor) createStatus(gtsClient *client.Client) error { } } - if c.addPoll && !c.attachmentIDs.Empty() { + numAttachmentIDs := len(attachmentIDs) + + if c.addPoll && numAttachmentIDs > 0 { return fmt.Errorf("attaching media to a poll is not allowed") } @@ -204,8 +206,8 @@ func (c *CreateExecutor) createStatus(gtsClient *client.Client) error { AttachmentIDs: nil, } - if !c.attachmentIDs.Empty() { - form.AttachmentIDs = c.attachmentIDs + if numAttachmentIDs > 0 { + form.AttachmentIDs = attachmentIDs } if c.addPoll {