From 69d1c9746ab7ccb1dc54fe1ca891acfc71b61547 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sat, 8 Jul 2023 23:50:25 +0200 Subject: [PATCH] [mastodon-client] drive file name fixup --- packages/megalodon/src/misskey.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/megalodon/src/misskey.ts b/packages/megalodon/src/misskey.ts index 97b17a0d6..39665572c 100644 --- a/packages/megalodon/src/misskey.ts +++ b/packages/megalodon/src/misskey.ts @@ -1646,17 +1646,14 @@ export default class Misskey implements MegalodonInterface { public async uploadMedia(file: any, options?: { description?: string; focus?: string }): Promise> { const formData = new FormData() formData.append('file', fs.createReadStream(file.path), { - contentType: file.mimetype, - filename: file.originalname + contentType: file.mimetype }) - if (file.originalname != null) { + if (file.originalname != null && file.originalname !== 'file') formData.append('name', file.originalname); - } - if (options?.description != null) { + if (options?.description != null) formData.append('comment', options.description); - } let headers: { [key: string]: string } = {} if (typeof formData.getHeaders === 'function') {