* Fixed: [restconf patch method unable to chage value to empty string #229](https://github.com/clicon/clixon/issues/229)

This commit is contained in:
Olof hagsand 2021-05-26 22:41:28 +02:00
parent ec4d26febf
commit 69af2884d0
2 changed files with 17 additions and 14 deletions

View file

@ -82,6 +82,7 @@ Users may have to change how they access the system
### Corrected Bugs
* Fixed: [restconf patch method unable to chage value to empty string #229](https://github.com/clicon/clixon/issues/229)
* Fixed: [when condition error under augment in restconf #227](https://github.com/clicon/clixon/issues/227)
* Fixed: [Using YANG union with decimal64 and string leads to regexp match fail #226](https://github.com/clicon/clixon/issues/226)
* Fixed: [xpath function count did not work properly #224](https://github.com/clicon/clixon/issues/224)

View file

@ -325,6 +325,8 @@ text_modify(clicon_handle h,
int changed = 0; /* Only if x0p's children have changed-> sort necessary */
cvec *nscx1 = NULL;
char *createstr = NULL;
yang_stmt *yrestype = NULL;
char *restype;
if (x1 == NULL){
clicon_err(OE_XML, EINVAL, "x1 is missing");
@ -461,13 +463,9 @@ text_modify(clicon_handle h,
goto done;
}
}
if (x1bstr){
/* Some bodies (eg identityref) requires proper namespace setup, so a type lookup is
* necessary.
*/
yang_stmt *yrestype = NULL;
char *restype;
if (yang_type_get(y0, NULL, &yrestype, NULL, NULL, NULL, NULL, NULL) < 0)
goto done;
if (yrestype == NULL){
@ -475,6 +473,10 @@ text_modify(clicon_handle h,
goto done;
}
restype = yang_argument_get(yrestype);
/* Differentiate between an empty type (NULL) and an empty string "" */
if (x1bstr==NULL && strcmp(restype,"string")==0)
x1bstr="";
if (x1bstr){
if (strcmp(restype, "identityref") == 0){
x1bstr = clixon_trim2(x1bstr, " \t\n");
if (check_body_namespace(x1, x0, x0p, x1bstr, y0) < 0)
@ -515,7 +517,7 @@ text_modify(clicon_handle h,
xml_flag_reset(x0, XML_FLAG_DEFAULT);
}
}
}
} /* x1bstr */
if (changed){
if (xml_insert(x0p, x0, insert, valstr, NULL) < 0)
goto done;