From fdc311983c3a854ae8952a952e3b3d463a07f265 Mon Sep 17 00:00:00 2001 From: limbo <43649186+HUAHUAI23@users.noreply.github.com> Date: Thu, 29 Jun 2023 11:44:15 +0800 Subject: [PATCH] fix(server): add length limits for function template name (#1333) --- .../src/function-template/dto/create-function-template.dto.ts | 3 ++- .../src/function-template/dto/update-function-template.dto.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/function-template/dto/create-function-template.dto.ts b/server/src/function-template/dto/create-function-template.dto.ts index 2a8d2c483f..608352062f 100644 --- a/server/src/function-template/dto/create-function-template.dto.ts +++ b/server/src/function-template/dto/create-function-template.dto.ts @@ -20,6 +20,7 @@ export class FunctionTemplateItemDto { description: 'FunctionTemplate item name', }) @IsNotEmpty() + @MaxLength(48) @Matches(/^[a-zA-Z0-9_.\-\/]{1,256}$/) name: string @@ -46,7 +47,7 @@ export class CreateFunctionTemplateDto { @ApiProperty({ description: 'function template name' }) @IsNotEmpty() @IsString() - @MaxLength(64) + @MaxLength(32) name: string @ApiProperty({ description: 'Dependencies', type: [CreateDependencyDto] }) diff --git a/server/src/function-template/dto/update-function-template.dto.ts b/server/src/function-template/dto/update-function-template.dto.ts index ffc5778dda..ff49f88808 100644 --- a/server/src/function-template/dto/update-function-template.dto.ts +++ b/server/src/function-template/dto/update-function-template.dto.ts @@ -23,7 +23,7 @@ export class UpdateFunctionTemplateDto { @ApiProperty({ description: 'Template name' }) @IsNotEmpty() - @MaxLength(64) + @MaxLength(32) @IsString() name: string