From 3ac95ab3b117ee8867a30c8e4b30ab37411e5ccf Mon Sep 17 00:00:00 2001 From: r Date: Sat, 23 Jan 2021 09:07:22 +0000 Subject: Use attachment file name as description Pleroma 2 no longer does it automatically. --- mastodon/mastodon.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 } -- cgit v1.2.3