From 18b06b036841e95f1ceb31436df1d21cf2a42b77 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sun, 5 May 2024 19:19:42 +0800 Subject: [PATCH] =?UTF-8?q?IP=E5=90=8D=E5=8D=95=E4=BB=A3=E5=8F=B7=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=95=BF=E5=BA=A6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/rpc/services/service_ip_list.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/rpc/services/service_ip_list.go b/internal/rpc/services/service_ip_list.go index d9881510..0b5059ee 100644 --- a/internal/rpc/services/service_ip_list.go +++ b/internal/rpc/services/service_ip_list.go @@ -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") }