mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-01 21:30:27 +08:00
IP名单代号增加长度限制
This commit is contained in:
@@ -50,6 +50,10 @@ func (this *IPListService) CreateIPList(ctx context.Context, req *pb.CreateIPLis
|
||||
|
||||
// 检查代号
|
||||
if len(req.Code) > 0 {
|
||||
if len(req.Code) > 100 {
|
||||
return nil, errors.New("too long 'code', should be short than 100 characters")
|
||||
}
|
||||
|
||||
if !models.SharedIPListDAO.ValidateIPListCode(req.Code) {
|
||||
return nil, errors.New("invalid 'code' format")
|
||||
}
|
||||
@@ -82,6 +86,10 @@ func (this *IPListService) UpdateIPList(ctx context.Context, req *pb.UpdateIPLis
|
||||
|
||||
// 检查代号
|
||||
if len(req.Code) > 0 {
|
||||
if len(req.Code) > 100 {
|
||||
return nil, errors.New("too long 'code', should be short than 100 characters")
|
||||
}
|
||||
|
||||
if !models.SharedIPListDAO.ValidateIPListCode(req.Code) {
|
||||
return nil, errors.New("invalid 'code' format")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user