Fix name checks

This commit is contained in:
Adria Navarro 2024-10-23 13:19:24 +02:00
parent 732d701a86
commit 46a7f15fed
1 changed files with 3 additions and 2 deletions

View File

@ -19,12 +19,13 @@ async function ensureUniqueAndThrow(
existingRowActionId?: string
) {
const names = await getNames(doc)
name = name.toLowerCase()
name = name.toLowerCase().trim()
if (
Object.entries(names).find(
([automationId, automationName]) =>
automationName === name && automationId !== existingRowActionId
automationName.toLowerCase().trim() === name &&
automationId !== existingRowActionId
)
) {
throw new HTTPError("A row action with the same name already exists.", 409)