From 41d696c6ca78317ee2f5210bd9ce53202bd556bd Mon Sep 17 00:00:00 2001 From: CutestNekoAqua Date: Thu, 23 Feb 2023 17:13:35 +0100 Subject: [PATCH] maybe buffer? --- packages/backend/src/server/api/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/server/api/index.ts b/packages/backend/src/server/api/index.ts index dcf79d16d..a49664136 100644 --- a/packages/backend/src/server/api/index.ts +++ b/packages/backend/src/server/api/index.ts @@ -82,8 +82,7 @@ mastoFileRouter.post("/v1/media", upload.single("file"), async (ctx) => { ctx.status = 401; return; } - const image = fs.readFileSync((multipartData).path); - const data = await client.uploadMedia(image); + const data = await client.uploadMedia(multipartData.buffer); ctx.body = data.data; } catch (e: any) { console.error(e); @@ -102,8 +101,7 @@ mastoFileRouter.post("/v2/media", upload.single("file"), async (ctx) => { ctx.status = 401; return; } - const image = fs.readFileSync((multipartData).path); - const data = await client.uploadMedia(image); + const data = await client.uploadMedia(multipartData.buffer); ctx.body = data.data; } catch (e: any) { console.error(e);