h3poteto / megalodon

Fediverse API client library for node.js and browser
https://h3poteto.github.io/megalodon/
MIT License
243 stars 28 forks source link

Pleroma: uploadMedia fails with 400 #1893

Open aneillans opened 11 months ago

aneillans commented 11 months ago

const M = generator('pleroma', https://${data.website}, data.tokenData.access_token);
const upload = await M.uploadMedia(file.value, { description: altText });

Upload aborts with a 400 against a newly deployed Pleroma instance; am I missing something? All variables are set with contents. Is there specific encodings needed?

Megalodon version: v7.0.0 Pleroma Version: 2.7.2

aneillans commented 11 months ago

Looking through the server log I can find this, but I though this issue was fixed previously?

19:21:11.539 request_id=F4NRSzugomogDCgAAD8i [error] Internal server error: %Plug.Parsers.BadEncodingError{message: "invalid UTF-8 on multipart body, got byte 255", plug_status: 400}

aneillans commented 11 months ago

In my original post, file.value is a Buffer.

If I save the contents to a temp file, then open with fs.createReadStream and pass that in, the upload works?