From c8bc0ba84accfb0e509bbe6a403186aa474b178e Mon Sep 17 00:00:00 2001 From: daniel-davidd Date: Thu, 17 Aug 2023 16:54:21 +0300 Subject: [PATCH] added validation if exist alone --- server/memphis_handlers_stations.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/memphis_handlers_stations.go b/server/memphis_handlers_stations.go index a7808d9a9..714f7ab68 100644 --- a/server/memphis_handlers_stations.go +++ b/server/memphis_handlers_stations.go @@ -232,7 +232,7 @@ func (s *Server) createStationDirectIntern(c *client, csr.TenantName = t.Name } - exist, station, err := db.GetStationByName(stationName.Ext(), csr.TenantName) + exist, _, err := db.GetStationByName(stationName.Ext(), csr.TenantName) if err != nil { serv.Errorf("[tenant: %v][user:%v]createStationDirect at db.GetStationByName: Station %v: %v", csr.TenantName, csr.Username, csr.StationName, err.Error()) jsApiResp.Error = NewJSStreamCreateError(err) @@ -240,7 +240,7 @@ func (s *Server) createStationDirectIntern(c *client, return } - if exist && ((csr.PartitionsNumber == 0 && len(station.PartitionsList) == 0) || (csr.PartitionsNumber > 0 && len(station.PartitionsList) > 0)) { + if exist { jsApiResp.Error = NewJSStreamNameExistError() respondWithErrOrJsApiRespWithEcho(!isNative, c, memphisGlobalAcc, _EMPTY_, reply, _EMPTY_, jsApiResp, err) return