mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 16:44:07 -08:00
⚡ Add name validation to PATCH /tags/:id
This commit is contained in:
parent
5047c10ee3
commit
85efe0424b
|
@ -816,6 +816,7 @@ class App {
|
|||
TagHelpers.validateRequestBody(req.body);
|
||||
|
||||
const { name } = req.body;
|
||||
await TagHelpers.validateName(name);
|
||||
TagHelpers.validateLength(name);
|
||||
|
||||
const id = Number(req.params.id);
|
||||
|
|
|
@ -2,7 +2,7 @@ import { FindOneOptions, getConnection } from "typeorm";
|
|||
import { Db, ResponseHelper } from ".";
|
||||
|
||||
/**
|
||||
* Validate whether a tag name exists so that it cannot be used for a create operation.
|
||||
* Validate whether a tag name exists so that it cannot be used for a create/update operation.
|
||||
*/
|
||||
export async function validateName(name: string): Promise<void> | never {
|
||||
const findQuery = { where: { name } } as FindOneOptions;
|
||||
|
|
Loading…
Reference in a new issue