Fix media upload
This commit is contained in:
parent
6ca8fc7231
commit
f8c328ff55
|
@ -9,6 +9,7 @@ import Response from './response'
|
|||
import Entity from './entity'
|
||||
import { MegalodonInterface, WebSocketInterface, NoImplementedError, ArgumentError, UnexpectedError } from './megalodon'
|
||||
import MegalodonEntity from "@/entity";
|
||||
import fs from "node:fs";
|
||||
|
||||
type AccountCache = {
|
||||
locks: AsyncLock,
|
||||
|
@ -1579,7 +1580,7 @@ export default class Misskey implements MegalodonInterface {
|
|||
*/
|
||||
public async uploadMedia(file: any, _options?: { description?: string; focus?: string }): Promise<Response<Entity.Attachment>> {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file.buffer, {
|
||||
formData.append('file', fs.createReadStream(file.path), {
|
||||
contentType: file.mimetype,
|
||||
filename: file.originalname,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue