summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMikhail Zhvakin <striker_1993@mail.ru>2023-07-25 17:03:32 +0300
committerMikhail Zhvakin <striker_1993@mail.ru>2024-01-16 01:02:51 +0300
commitf347756661ff81ff859ec15c16a0348ef5165bed (patch)
tree3cdfec57857c363dd009f2fe5c8792418c5e02d7 /include
parenta684c226d60889f862740260a654ea7b3fafc7b0 (diff)
downloadbmcweb-f347756661ff81ff859ec15c16a0348ef5165bed.tar.xz
DBus REST: Fix array and dict handling
The bmcweb DBus REST API cannot currently handle array or dictionary data types correctly. This commit is meant to fix that. Tested: get/set DBus attributes (consisting of array and/or dictionary) via bmcweb DBus REST API. Change-Id: I9694cb888375c90d7a8fb1a10e53bdb5c0bce3bb Signed-off-by: Mikhail Zhvakin <striker_1993@mail.ru>
Diffstat (limited to 'include')
-rw-r--r--include/openbmc_dbus_rest.hpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index e0c16d9e8f..6bd3920587 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -863,7 +863,7 @@ inline int convertJsonToDbus(sd_bus_message* m, const std::string& argType,
}
else if (argCode.starts_with("(") && argCode.ends_with(")"))
{
- std::string containedType = argCode.substr(1, argCode.size() - 1);
+ std::string containedType = argCode.substr(1, argCode.size() - 2);
r = sd_bus_message_open_container(m, SD_BUS_TYPE_STRUCT,
containedType.c_str());
if (r < 0)
@@ -872,7 +872,7 @@ inline int convertJsonToDbus(sd_bus_message* m, const std::string& argType,
}
nlohmann::json::const_iterator it = j->begin();
- for (const std::string& argCode2 : dbusArgSplit(argType))
+ for (const std::string& argCode2 : dbusArgSplit(containedType))
{
if (it == j->end())
{
@@ -889,7 +889,7 @@ inline int convertJsonToDbus(sd_bus_message* m, const std::string& argType,
}
else if (argCode.starts_with("{") && argCode.ends_with("}"))
{
- std::string containedType = argCode.substr(1, argCode.size() - 1);
+ std::string containedType = argCode.substr(1, argCode.size() - 2);
r = sd_bus_message_open_container(m, SD_BUS_TYPE_DICT_ENTRY,
containedType.c_str());
if (r < 0)