fix(notifications): validate name is not empty

This commit is contained in:
Nicolas Meienberger 2026-01-29 20:41:12 +01:00
parent 5ec100b3bc
commit 779542e8bd

View file

@ -143,6 +143,10 @@ const createDestination = async (name: string, config: NotificationConfig) => {
const organizationId = getOrganizationId();
const trimmedName = name.trim();
if (trimmedName.length === 0) {
throw new InternalServerError("Name cannot be empty or whitespace-only");
}
const encryptedConfig = await encryptSensitiveFields(config);
const [created] = await db
@ -178,7 +182,11 @@ const updateDestination = async (
};
if (updates.name !== undefined) {
updateData.name = updates.name.trim();
const trimmedName = updates.name.trim();
if (trimmedName.length === 0) {
throw new InternalServerError("Name cannot be empty or whitespace-only");
}
updateData.name = trimmedName;
}
if (updates.enabled !== undefined) {