diff options
author | ChrisChrome <christophercookman@gmail.com> | 2022-08-12 23:44:50 -0600 |
---|---|---|
committer | ChrisChrome <christophercookman@gmail.com> | 2022-08-12 23:44:50 -0600 |
commit | d9760fe9146ba87a8296a566abbb4aa7ab61c750 (patch) | |
tree | 8565b55fe88b251a8784f3ed1715337aef21d353 | |
parent | Made nitro stuff make some sense (diff) | |
download | server-d9760fe9146ba87a8296a566abbb4aa7ab61c750.tar.xz |
Handle avatar uploads
-rw-r--r-- | api/src/routes/applications/#id/bot/index.ts | 4 |
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); |