aa
This commit is contained in:
parent
0be450d95f
commit
19d84a73ac
1 changed files with 4 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue