From 3eb5a3f420c80c1b99ec0921f497e7c513e96fad Mon Sep 17 00:00:00 2001 From: BoryaGames <67229357+BoryaGames@users.noreply.github.com> Date: Sun, 11 Feb 2024 04:39:09 +0500 Subject: Fix application icons (#1110) Co-authored-by: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> --- src/api/routes/applications/#id/index.ts | 8 ++++++++ src/api/routes/guilds/#guild_id/bans.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/routes/applications/#id/index.ts b/src/api/routes/applications/#id/index.ts index c372869a..949d66f8 100644 --- a/src/api/routes/applications/#id/index.ts +++ b/src/api/routes/applications/#id/index.ts @@ -21,6 +21,7 @@ import { Application, ApplicationModifySchema, DiscordApiErrors, + handleFile, } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; @@ -83,6 +84,13 @@ router.patch( ) throw new HTTPError(req.t("auth:login.INVALID_TOTP_CODE"), 60008); + if (body.icon) { + body.icon = await handleFile( + `/app-icons/${app.id}`, + body.icon as string, + ); + } + if (app.bot) { app.bot.assign({ bio: body.description }); await app.bot.save(); diff --git a/src/api/routes/guilds/#guild_id/bans.ts b/src/api/routes/guilds/#guild_id/bans.ts index 9aeb27f0..d399e549 100644 --- a/src/api/routes/guilds/#guild_id/bans.ts +++ b/src/api/routes/guilds/#guild_id/bans.ts @@ -195,7 +195,7 @@ router.delete( async (req: Request, res: Response) => { const { guild_id, user_id } = req.params; - const ban = await Ban.findOneOrFail({ + await Ban.findOneOrFail({ where: { guild_id: guild_id, user_id: user_id }, }); -- cgit 1.4.1