diff options
author | r <r@freesoftwareextremist.com> | 2021-01-23 09:07:22 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2021-01-23 09:08:46 +0000 |
commit | 3ac95ab3b117ee8867a30c8e4b30ab37411e5ccf (patch) | |
tree | 20abd4387955c8d657834a34e81d37f2dc724dfd | |
parent | ac342dde079a0ca156c36a402a3c0ba86d78821d (diff) | |
download | bloat-3ac95ab3b117ee8867a30c8e4b30ab37411e5ccf.tar.gz bloat-3ac95ab3b117ee8867a30c8e4b30ab37411e5ccf.zip |
Use attachment file name as description
Pleroma 2 no longer does it automatically.
-rw-r--r-- | mastodon/mastodon.go | 7 |
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 } |