1
Bug reports / JSON output should escape backslashes
« on: November 29, 2018, 04:39:59 am »
When I give DSSR a filename which contains a backslash (e.g. as a path seperator on Windows), this backslash gets included in the created JSON in the fields "command", "input_file" and possibly "str_id".
This makes the JSON invalid and impossible to parse, because backslashes are escape characters in JSON and have to be escaped as "\\" to produce valid JSON.
Example:
rename 1rnk.pdb into '1rnk\something.pdb'
./x3dna-dssr -i='1rnk\something.pdb' --json
Gives a JSON including
{"command":"x3dna-dssr -i=1rnk\something.pdb --json","input_file":"1rnk\something.pdb","str_id":"1rnk\something"
instead of
{"command":"x3dna-dssr -i=1rnk\\something.pdb --json","input_file":"1rnk\\something.pdb","str_id":"1rnk\\something"
This makes the JSON invalid and impossible to parse, because backslashes are escape characters in JSON and have to be escaped as "\\" to produce valid JSON.
Example:
rename 1rnk.pdb into '1rnk\something.pdb'
./x3dna-dssr -i='1rnk\something.pdb' --json
Gives a JSON including
{"command":"x3dna-dssr -i=1rnk\something.pdb --json","input_file":"1rnk\something.pdb","str_id":"1rnk\something"
instead of
{"command":"x3dna-dssr -i=1rnk\\something.pdb --json","input_file":"1rnk\\something.pdb","str_id":"1rnk\\something"