From 358d7f66003704d0a4861144d5c239bbc722d058 Mon Sep 17 00:00:00 2001 From: travisladuke Date: Thu, 22 Feb 2024 11:34:43 -0800 Subject: [PATCH] Fix unstable network member list endpoint It was returning an array of array instead of just array --- controller/EmbeddedNetworkController.cpp | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/controller/EmbeddedNetworkController.cpp b/controller/EmbeddedNetworkController.cpp index d6405e342..de44eff09 100644 --- a/controller/EmbeddedNetworkController.cpp +++ b/controller/EmbeddedNetworkController.cpp @@ -1094,26 +1094,26 @@ void EmbeddedNetworkController::configureHTTPControlPlane( auto out = nlohmann::json::object(); auto meta = nlohmann::json::object(); - auto members = nlohmann::json::array(); std::vector memTmp; if (_db.get(nwid, network, memTmp)) { - members.push_back(memTmp); - } - - uint64_t authorizedCount = 0; - uint64_t totalCount = memTmp.size(); - for (auto m = memTmp.begin(); m != memTmp.end(); ++m) { - bool a = OSUtils::jsonBool((*m)["authorized"], 0); - if (a) { authorizedCount++; } - } + uint64_t authorizedCount = 0; + uint64_t totalCount = memTmp.size(); + for (auto m = memTmp.begin(); m != memTmp.end(); ++m) { + bool a = OSUtils::jsonBool((*m)["authorized"], 0); + if (a) { authorizedCount++; } + } - meta["totalCount"] = totalCount; - meta["authorizedCount"] = authorizedCount; + meta["totalCount"] = totalCount; + meta["authorizedCount"] = authorizedCount; - out["data"] = members; - out["meta"] = meta; + out["data"] = memTmp; + out["meta"] = meta; - setContent(req, res, out.dump()); + setContent(req, res, out.dump()); + } else { + res.status = 404; + return; + } }; s.Get(memberListPath2, memberListGet2); sv6.Get(memberListPath2, memberListGet2);