Fix name checks
This commit is contained in:
parent
732d701a86
commit
46a7f15fed
|
@ -19,12 +19,13 @@ async function ensureUniqueAndThrow(
|
||||||
existingRowActionId?: string
|
existingRowActionId?: string
|
||||||
) {
|
) {
|
||||||
const names = await getNames(doc)
|
const names = await getNames(doc)
|
||||||
name = name.toLowerCase()
|
name = name.toLowerCase().trim()
|
||||||
|
|
||||||
if (
|
if (
|
||||||
Object.entries(names).find(
|
Object.entries(names).find(
|
||||||
([automationId, automationName]) =>
|
([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)
|
throw new HTTPError("A row action with the same name already exists.", 409)
|
||||||
|
|
Loading…
Reference in New Issue