Micro-service via JSON plugin: remove dot from the main object when loading the tree

This commit is contained in:
Amin Ben Romdhane 2024-01-24 10:57:19 +00:00
parent b3945f8b0e
commit 147168fcd5
2 changed files with 8 additions and 2 deletions

View file

@ -107,11 +107,17 @@ int load_json_plugin(struct list_head *json_plugin, struct list_head *json_list,
char obj_prefix[1024] = {0};
json_plugin_find_prefix_obj(node_obj, obj_prefix, sizeof(obj_prefix));
if (strlen(obj_prefix) == 0) {
int obj_prefix_len = strlen(obj_prefix);
if (obj_prefix_len == 0) {
ERR("ERROR: Obj prefix is empty for (%s) Object\n", node_obj);
return -1;
}
// Remove '.' from object prefix
if (obj_prefix[obj_prefix_len - 1] == '.')
obj_prefix[obj_prefix_len - 1] = 0;
DMOBJ *dm_entryobj = (DMOBJ *)dm_dynamic_calloc(json_memhead, 2, sizeof(DMOBJ));
if (dm_entryobj == NULL) {
ERR("ERROR: No Memory exists\n");

View file

@ -432,7 +432,7 @@ static void dm_browse_service(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *e
if (dmctx->checkobj) {
*err = dmctx->checkobj(dmctx, &node, NULL, NULL, NULL, NULL, data, instance);
if (*err && !dmctx->inparam_isparam && DM_STRSTR(dmctx->in_param, parent_obj) != dmctx->in_param)
if (*err)
return;
}