aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mastodon/mastodon.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/mastodon/mastodon.go b/mastodon/mastodon.go
index 658b09b..8678314 100644
--- a/mastodon/mastodon.go
+++ b/mastodon/mastodon.go
@@ -91,7 +91,12 @@ func (c *Client) doAPI(ctx context.Context, method string, uri string, params in
var buf bytes.Buffer
mw := multipart.NewWriter(&buf)
- part, err := mw.CreateFormFile("file", filepath.Base(file.Filename))
+ fname := filepath.Base(file.Filename)
+ err = mw.WriteField("description", fname)
+ if err != nil {
+ return err
+ }
+ part, err := mw.CreateFormFile("file", fname)
if err != nil {
return err
}