diff options
author | Volpeon <git@volpeon.ink> | 2021-10-19 19:33:02 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2021-10-19 19:33:02 +0200 |
commit | c4e3ec920e3bcc0f57ffae03dce3c309a611eb08 (patch) | |
tree | 67695dbf8b070535906069e0cc511846a2c75a4c /src/api/mastodon/index.ts | |
parent | Code improvements, support a manual post queue (diff) | |
download | feralbot-c4e3ec920e3bcc0f57ffae03dce3c309a611eb08.tar.gz feralbot-c4e3ec920e3bcc0f57ffae03dce3c309a611eb08.tar.bz2 feralbot-c4e3ec920e3bcc0f57ffae03dce3c309a611eb08.zip |
Fix error
Diffstat (limited to 'src/api/mastodon/index.ts')
-rw-r--r-- | src/api/mastodon/index.ts | 4 |
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({ | |||
22 | export async function upload(buf: Buffer, filename: string) { | 22 | export 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 | ||