Browse Source

fix empty client ID on request

Co-Authored-By: Alireza Ahmadi <[email protected]>
mhsanaei 10 months ago
parent
commit
e794d3d87f
1 changed files with 2 additions and 2 deletions
  1. 2 2
      web/service/inbound.go

+ 2 - 2
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")
 	}