From a7a5c3a5f3ed3a2832fed1c47465bb2c0e39f96a Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Sun, 21 Apr 2024 00:58:37 +0330 Subject: [PATCH] fix empty client ID on request Co-Authored-By: Alireza Ahmadi --- web/service/inbound.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/service/inbound.go b/web/service/inbound.go index 95962041..8dc2f6b9 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -609,7 +609,7 @@ func (s *InboundService) UpdateInboundClient(data *model.Inbound, clientId strin oldEmail := "" newClientId := "" - clientIndex := 0 + clientIndex := -1 for index, oldClient := range oldClients { oldClientId := "" if oldInbound.Protocol == "trojan" { @@ -630,7 +630,7 @@ func (s *InboundService) UpdateInboundClient(data *model.Inbound, clientId strin } // Validate new client ID - if newClientId == "" { + if newClientId == "" || clientIndex == -1 { return false, common.NewError("empty client ID") }