File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1393,10 +1393,22 @@ static void setup_command_usage(struct lightningd *ld,
1393
1393
bool jsonrpc_command_add (struct jsonrpc * rpc , struct json_command * command ,
1394
1394
const char * usage TAKES )
1395
1395
{
1396
+ struct json_escape * esc ;
1397
+ const char * unescaped ;
1398
+
1396
1399
if (!command_add (rpc , command ))
1397
1400
return false;
1398
- usage = tal_strdup (command , usage );
1399
- strmap_add (& rpc -> usagemap , command -> name , usage );
1401
+
1402
+ esc = json_escape_string_ (tmpctx , usage , strlen (usage ));
1403
+ unescaped = json_escape_unescape (command , esc );
1404
+ if (!unescaped )
1405
+ unescaped = tal_strdup (command , usage );
1406
+ else {
1407
+ if (taken (usage ))
1408
+ tal_free (usage );
1409
+ }
1410
+
1411
+ strmap_add (& rpc -> usagemap , command -> name , unescaped );
1400
1412
tal_add_destructor2 (command , destroy_json_command , rpc );
1401
1413
return true;
1402
1414
}
You can’t perform that action at this time.
0 commit comments