summaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2021-10-19 19:33:02 +0200
committerVolpeon <git@volpeon.ink>2021-10-19 19:33:02 +0200
commitc4e3ec920e3bcc0f57ffae03dce3c309a611eb08 (patch)
tree67695dbf8b070535906069e0cc511846a2c75a4c /src/api
parentCode improvements, support a manual post queue (diff)
downloadferalbot-c4e3ec920e3bcc0f57ffae03dce3c309a611eb08.tar.gz
feralbot-c4e3ec920e3bcc0f57ffae03dce3c309a611eb08.tar.bz2
feralbot-c4e3ec920e3bcc0f57ffae03dce3c309a611eb08.zip
Fix error
Diffstat (limited to 'src/api')
-rw-r--r--src/api/mastodon/index.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/api/mastodon/index.ts b/src/api/mastodon/index.ts
index f3bf45c..3bfe9c8 100644
--- a/src/api/mastodon/index.ts
+++ b/src/api/mastodon/index.ts
@@ -22,6 +22,10 @@ export const client = got.extend({
22export async function upload(buf: Buffer, filename: string) { 22export async function upload(buf: Buffer, filename: string) {
23 const type = await fileType.fromBuffer(buf); 23 const type = await fileType.fromBuffer(buf);
24 24
25 if (!type) {
26 throw new Error("Couldn't determine file type");
27 }
28
25 const body = new FormData(); 29 const body = new FormData();
26 body.append("file", buf, { filename: `${filename}.${type.ext}`, contentType: type.mime }); 30 body.append("file", buf, { filename: `${filename}.${type.ext}`, contentType: type.mime });
27 31