This commit is contained in:
CutestNekoAqua 2023-02-23 17:38:18 +01:00
parent 0be450d95f
commit 19d84a73ac
1 changed files with 4 additions and 4 deletions

View File

@ -76,13 +76,13 @@ mastoFileRouter.post("/v1/media", upload.single("file"), async (ctx) => {
const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens);
try {
let multipartData = await ctx.request.file;
let multipartData = await ctx.file;
if (!multipartData) {
ctx.body = { error: "No image" };
ctx.status = 401;
return;
}
const data = await client.uploadMedia(multipartData);
const data = await client.uploadMedia(multipartData.buffer);
ctx.body = data.data;
} catch (e: any) {
console.error(e);
@ -95,13 +95,13 @@ mastoFileRouter.post("/v2/media", upload.single("file"), async (ctx) => {
const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens);
try {
let multipartData = await ctx.request.file;
let multipartData = await ctx.file;
if (!multipartData) {
ctx.body = { error: "No image" };
ctx.status = 401;
return;
}
const data = await client.uploadMedia(multipartData);
const data = await client.uploadMedia(multipartData.buffer);
ctx.body = data.data;
} catch (e: any) {
console.error(e);