Use attachment file name as description

Pleroma 2 no longer does it automatically.
This commit is contained in:
r 2021-01-23 09:07:22 +00:00
parent ac342dde07
commit 3ac95ab3b1
1 changed files with 6 additions and 1 deletions

View File

@ -91,7 +91,12 @@ func (c *Client) doAPI(ctx context.Context, method string, uri string, params in
var buf bytes.Buffer var buf bytes.Buffer
mw := multipart.NewWriter(&buf) 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 { if err != nil {
return err return err
} }