fix(repos): ssh url 校验规则修改,不强制要求仅有用户名时要求追加:分隔。
This commit is contained in:
@ -3,6 +3,7 @@ import {
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUrl,
|
||||
Matches,
|
||||
MaxLength,
|
||||
MinLength,
|
||||
} from 'class-validator';
|
||||
@ -19,7 +20,9 @@ export class CreateProjectInput {
|
||||
@MinLength(2)
|
||||
comment: string;
|
||||
|
||||
@IsUrl({ protocols: ['ssh'] })
|
||||
@Matches(
|
||||
/^(?:ssh:\/\/)?(?:[\w\d-_]+@)(?:[\w\d-_]+\.)*\w{2,10}(?::\d{1,5})?(?:\/[\w\d-_.]+)*/,
|
||||
)
|
||||
@MaxLength(256)
|
||||
sshUrl: string;
|
||||
|
||||
|
Reference in New Issue
Block a user