diff --git a/CHANGELOG.md b/CHANGELOG.md index f17dfb00..5cc79462 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Expected: May 2024 ### Corrected Bugs +* Fixed: [CLI: Explicit api-path not encoded correctly](https://github.com/clicon/clixon/issues/504) * Fixed: [Startup and default of same object causes too-many-elements error](https://github.com/clicon/clixon/issues/503) ## 7.0.0 diff --git a/lib/src/clixon_path.c b/lib/src/clixon_path.c index ab4bf80f..808fe06a 100644 --- a/lib/src/clixon_path.c +++ b/lib/src/clixon_path.c @@ -513,7 +513,7 @@ api_path_fmt_subst_list_key(cbuf *cb, * cvv: foo, bar * api_path: /subif-entry=foo,bar/subid * - * "api-path" is "URI-encoded path expression" definition in RFC8040 3.5.3 (note only =%s) + * "api-path" is "URI-encoded path expression" definition in RFC8040 3.5.3 (note only =%s/=,%s) */ int api_path_fmt2api_path(const char *api_path_fmt, @@ -524,7 +524,6 @@ api_path_fmt2api_path(const char *api_path_fmt, { int retval = -1; char c; - char cprev; int esc = 0; int uri_encode = 0; cbuf *cb = NULL; @@ -541,7 +540,6 @@ api_path_fmt2api_path(const char *api_path_fmt, } j = 1; /* j==0 is cli string */ len = strlen(api_path_fmt); - cprev = 0; for (i=0; i b ,cli_merge("/example:x/m1=%s,%s/");{ c ,cli_merge("/example:x/m1=%s,%s/c"); } + ax ("special case") c ,cli_merge("/example:x/m1=,%s/c"); } # Negative err x,cli_set("/example2:x");{ @@ -105,6 +106,18 @@ expectpart "$($clixon_cli -1 -f $cfg set x a 22 b 33 c 55)" 0 "" new "show conf x" expectpart "$($clixon_cli -1 -f $cfg show conf x)" 0 "x m1 a 22 b 33" +new "set conf x, special case comma" +expectpart "$($clixon_cli -1 -f $cfg set x ax 11 c 33)" 0 "^$" + +new "show conf ax" +expectpart "$($clixon_cli -1 -f $cfg show conf x)" 0 "x m1 a (null) b 11 c 33" + +new "set conf x, special case comma encoding" +expectpart "$($clixon_cli -1 -f $cfg set x ax 22/22 c 44)" 0 "^$" + +new "show conf ax" +expectpart "$($clixon_cli -1 -f $cfg show conf x)" 0 "x m1 a (null) b 22/22 c 44" + # Negative tests new "err x" expectpart "$($clixon_cli -1 -f $cfg -l n err x)" 255 "Config error: api-path syntax error \"/example2:x\": application unknown-element No such yang module prefix example2: Invalid argument"