Fossil SCM
fixed how many path parts are generated for the "command" response property.
Commit
3d6cc1df782e75369b94c98b779e0dc917daad04
Parent
faaf7387d90f126…
1 file changed
+5
-4
+5
-4
| --- src/json.c | ||
| +++ src/json.c | ||
| @@ -1286,22 +1286,23 @@ | ||
| 1286 | 1286 | cson_value * json_new_timestamp(cson_int_t timeVal){ |
| 1287 | 1287 | return cson_value_new_integer((timeVal<0) ? (cson_int_t)time(0) : timeVal); |
| 1288 | 1288 | } |
| 1289 | 1289 | |
| 1290 | 1290 | /* |
| 1291 | -** Internal helper for json_create_response(). Appends all elements of | |
| 1292 | -** g.json.cmd.a, except the first one, to a string and returns that | |
| 1293 | -** string value (which is owned by the caller). | |
| 1291 | +** Internal helper for json_create_response(). Appends the first | |
| 1292 | +** g.json.dispatchDepth elements of g.json.cmd.a, skipping the first | |
| 1293 | +** one (the "json" part), to a string and returns that string value | |
| 1294 | +** (which is owned by the caller). | |
| 1294 | 1295 | */ |
| 1295 | 1296 | static cson_value * json_response_command_path(){ |
| 1296 | 1297 | if(!g.json.cmd.a){ |
| 1297 | 1298 | return NULL; |
| 1298 | 1299 | }else{ |
| 1299 | 1300 | cson_value * rc = NULL; |
| 1300 | 1301 | Blob path = empty_blob; |
| 1301 | 1302 | char const * part; |
| 1302 | - unsigned int aLen = cson_array_length_get(g.json.cmd.a); | |
| 1303 | + unsigned int aLen = g.json.dispatchDepth+1; /*cson_array_length_get(g.json.cmd.a);*/ | |
| 1303 | 1304 | unsigned int i = 1; |
| 1304 | 1305 | for( ; i < aLen; ++i ){ |
| 1305 | 1306 | char const * part = cson_string_cstr(cson_value_get_string(cson_array_get(g.json.cmd.a, i))); |
| 1306 | 1307 | blob_append(&path,part,-1); |
| 1307 | 1308 | if(i < (aLen-1)){ |
| 1308 | 1309 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -1286,22 +1286,23 @@ | |
| 1286 | cson_value * json_new_timestamp(cson_int_t timeVal){ |
| 1287 | return cson_value_new_integer((timeVal<0) ? (cson_int_t)time(0) : timeVal); |
| 1288 | } |
| 1289 | |
| 1290 | /* |
| 1291 | ** Internal helper for json_create_response(). Appends all elements of |
| 1292 | ** g.json.cmd.a, except the first one, to a string and returns that |
| 1293 | ** string value (which is owned by the caller). |
| 1294 | */ |
| 1295 | static cson_value * json_response_command_path(){ |
| 1296 | if(!g.json.cmd.a){ |
| 1297 | return NULL; |
| 1298 | }else{ |
| 1299 | cson_value * rc = NULL; |
| 1300 | Blob path = empty_blob; |
| 1301 | char const * part; |
| 1302 | unsigned int aLen = cson_array_length_get(g.json.cmd.a); |
| 1303 | unsigned int i = 1; |
| 1304 | for( ; i < aLen; ++i ){ |
| 1305 | char const * part = cson_string_cstr(cson_value_get_string(cson_array_get(g.json.cmd.a, i))); |
| 1306 | blob_append(&path,part,-1); |
| 1307 | if(i < (aLen-1)){ |
| 1308 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -1286,22 +1286,23 @@ | |
| 1286 | cson_value * json_new_timestamp(cson_int_t timeVal){ |
| 1287 | return cson_value_new_integer((timeVal<0) ? (cson_int_t)time(0) : timeVal); |
| 1288 | } |
| 1289 | |
| 1290 | /* |
| 1291 | ** Internal helper for json_create_response(). Appends the first |
| 1292 | ** g.json.dispatchDepth elements of g.json.cmd.a, skipping the first |
| 1293 | ** one (the "json" part), to a string and returns that string value |
| 1294 | ** (which is owned by the caller). |
| 1295 | */ |
| 1296 | static cson_value * json_response_command_path(){ |
| 1297 | if(!g.json.cmd.a){ |
| 1298 | return NULL; |
| 1299 | }else{ |
| 1300 | cson_value * rc = NULL; |
| 1301 | Blob path = empty_blob; |
| 1302 | char const * part; |
| 1303 | unsigned int aLen = g.json.dispatchDepth+1; /*cson_array_length_get(g.json.cmd.a);*/ |
| 1304 | unsigned int i = 1; |
| 1305 | for( ; i < aLen; ++i ){ |
| 1306 | char const * part = cson_string_cstr(cson_value_get_string(cson_array_get(g.json.cmd.a, i))); |
| 1307 | blob_append(&path,part,-1); |
| 1308 | if(i < (aLen-1)){ |
| 1309 |