fix for escaping json control characters in graphql

double escape, once for java and once for json

fixes https://github.com/hapifhir/hapi-fhir/issues/3069
This commit is contained in:
Jan-Peter Lechler 2021-12-16 12:27:02 +01:00
parent 19087d2cb5
commit 185c8b99f7
2 changed files with 4 additions and 4 deletions

View File

@ -102,8 +102,8 @@ public class Argument {
public void write(StringBuilder b, int indent) throws EGraphQLException, EGraphEngine {
b.append("\"");
for (char ch : name.toCharArray()) {
if (ch == '"') b.append("\"");
else if (ch == '\\') b.append("\\");
if (ch == '"') b.append("\\\"");
else if (ch == '\\') b.append("\\\\");
else if (ch == '\r') b.append("\\r");
else if (ch == '\n') b.append("\\n");
else if (ch == '\t') b.append("\\t");

View File

@ -56,8 +56,8 @@ public class StringValue extends Value {
public void write(StringBuilder b, int indent) {
b.append("\"");
for (char ch : value.toCharArray()) {
if (ch == '"') b.append("\"");
else if (ch == '\\') b.append("\\");
if (ch == '"') b.append("\\\"");
else if (ch == '\\') b.append("\\\\");
else if (ch == '\r') b.append("\\r");
else if (ch == '\n') b.append("\\n");
else if (ch == '\t') b.append("\\t");