summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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