aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2021-01-23 09:07:22 +0000
committerr <r@freesoftwareextremist.com>2021-01-23 09:08:46 +0000
commit3ac95ab3b117ee8867a30c8e4b30ab37411e5ccf (patch)
tree20abd4387955c8d657834a34e81d37f2dc724dfd
parentac342dde079a0ca156c36a402a3c0ba86d78821d (diff)
downloadbloat-3ac95ab3b117ee8867a30c8e4b30ab37411e5ccf.tar.gz
bloat-3ac95ab3b117ee8867a30c8e4b30ab37411e5ccf.zip
Use attachment file name as description
Pleroma 2 no longer does it automatically.
-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
}