summary refs log tree commit diff
diff options
context:
space:
mode:
authorChrisChrome <christophercookman@gmail.com>2022-08-12 23:44:50 -0600
committerChrisChrome <christophercookman@gmail.com>2022-08-12 23:44:50 -0600
commitd9760fe9146ba87a8296a566abbb4aa7ab61c750 (patch)
tree8565b55fe88b251a8784f3ed1715337aef21d353
parentMade nitro stuff make some sense (diff)
downloadserver-d9760fe9146ba87a8296a566abbb4aa7ab61c750.tar.xz
Handle avatar uploads
-rw-r--r--api/src/routes/applications/#id/bot/index.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/api/src/routes/applications/#id/bot/index.ts b/api/src/routes/applications/#id/bot/index.ts
index a51c9526..562c31fe 100644
--- a/api/src/routes/applications/#id/bot/index.ts
+++ b/api/src/routes/applications/#id/bot/index.ts
@@ -1,6 +1,6 @@
 import { Request, Response, Router } from "express";
 import { route } from "@fosscord/api";
-import { Application, Config, FieldErrors, generateToken, OrmUtils, Snowflake, trimSpecial, User } from "@fosscord/util";
+import { Application, Config, FieldErrors, generateToken, OrmUtils, Snowflake, trimSpecial, User, handleFile } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 import { verifyToken } from "node-2fa";
 
@@ -74,7 +74,7 @@ router.post("/reset", route({}), async (req: Request, res: Response) => {
 });
 
 router.patch("/", route({}), async (req: Request, res: Response) => {
-	delete req.body.avatar;
+	if (req.body.avatar) req.body.avatar = await handleFile(`/avatars/${req.params.id}`, req.body.avatar as string);
 	let app = OrmUtils.mergeDeep(await User.findOne({where: {id: req.params.id}}), req.body);
 	await app.save();
 	res.json(app).status(200);