fix: adding description not working on media

This commit is contained in:
Mar0xy 2023-09-25 18:46:17 +02:00
parent b070e85566
commit 324cc5509e
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
3 changed files with 8 additions and 4 deletions

View file

@ -143,7 +143,7 @@ export class MastodonApiServerService {
const data = await client.uploadMedia(multipartData); const data = await client.uploadMedia(multipartData);
reply.send(convertAttachment(data.data as Entity.Attachment)); reply.send(convertAttachment(data.data as Entity.Attachment));
} catch (e: any) { } catch (e: any) {
console.error(e); /* console.error(e); */
reply.code(401).send(e.response.data); reply.code(401).send(e.response.data);
} }
}); });
@ -158,11 +158,10 @@ export class MastodonApiServerService {
reply.code(401).send({ error: 'No image' }); reply.code(401).send({ error: 'No image' });
return; return;
} }
console.error(_request.body);
const data = await client.uploadMedia(multipartData, _request.body!); const data = await client.uploadMedia(multipartData, _request.body!);
reply.send(convertAttachment(data.data as Entity.Attachment)); reply.send(convertAttachment(data.data as Entity.Attachment));
} catch (e: any) { } catch (e: any) {
console.error(e); /* console.error(e); */
reply.code(401).send(e.response.data); reply.code(401).send(e.response.data);
} }
}); });

View file

@ -377,7 +377,7 @@ export class ApiStatusMastodon {
const data = await client.updateMedia(convertId(_request.params.id, IdType.SharkeyId), _request.body as any); const data = await client.updateMedia(convertId(_request.params.id, IdType.SharkeyId), _request.body as any);
reply.send(convertAttachment(data.data)); reply.send(convertAttachment(data.data));
} catch (e: any) { } catch (e: any) {
console.error(e); /* console.error(e); */
reply.code(401).send(e.response.data); reply.code(401).send(e.response.data);
} }
}); });

View file

@ -1446,6 +1446,11 @@ export default class Misskey implements MegalodonInterface {
isSensitive: options.is_sensitive isSensitive: options.is_sensitive
}) })
} }
if (options.description !== undefined) {
params = Object.assign(params, {
comment: options.description,
});
}
} }
return this.client return this.client
.post<MisskeyAPI.Entity.File>('/api/drive/files/update', params) .post<MisskeyAPI.Entity.File>('/api/drive/files/update', params)