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,
13931393bool jsonrpc_command_add (struct jsonrpc * rpc , struct json_command * command ,
13941394 const char * usage TAKES )
13951395{
1396+ struct json_escape * esc ;
1397+ const char * unescaped ;
1398+
13961399 if (!command_add (rpc , command ))
13971400 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 );
14001412 tal_add_destructor2 (command , destroy_json_command , rpc );
14011413 return true;
14021414}
You can’t perform that action at this time.
0 commit comments