mirror of
https://github.com/spacebarchat/server.git
synced 2026-03-31 00:45:41 +00:00
fest: throw an error if application name is empty
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Application, DiscordApiErrors, Guild, handleFile, User } from "@spacebar/util";
|
||||
import { Application, DiscordApiErrors, FieldErrors, Guild, handleFile, User } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { verifyToken } from "node-2fa";
|
||||
@@ -73,6 +73,15 @@ router.patch(
|
||||
|
||||
if (app.owner.totp_secret && (!req.body.code || verifyToken(app.owner.totp_secret, req.body.code))) throw new HTTPError(req.t("auth:login.INVALID_TOTP_CODE"), 60008);
|
||||
|
||||
if (body.name?.trim() == "") {
|
||||
throw FieldErrors({
|
||||
name: {
|
||||
code: "BASE_TYPE_REQUIRED",
|
||||
message: req.t("common:field.BASE_TYPE_REQUIRED"),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (body.icon) {
|
||||
body.icon = await handleFile(`/app-icons/${app.id}`, body.icon as string);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user