[Graphql] Escape strings (#3143)
When I ran it on all the graphql files of fb, none of them had escape, but someone reported this issue!
This commit is contained in:
1 parent
bb145c19c1
commit
ec18ebc6c6
4 files changed
+13
-1
No files matched your search
@@ -108,7 +108,7 @@ function genericPrint(path, options, print) {
|
||||
return n.value;
|
||||
}
|
||||
case "StringValue": {
|
||||
return concat(['"', n.value, '"']);
|
||||
return concat(['"', n.value.replace(/["\\]/g, "\\$&"), '"']);
|
||||
}
|
||||
case "IntValue":
|
||||
case "FloatValue":
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`string.graphql 1`] = `
|
||||
query X($a: Int) @relay(meta: "{\\"lowPri\\": true}") { a }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
query X($a: Int) @relay(meta: "{\\"lowPri\\": true}") {
|
||||
a
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -0,0 +1 @@
|
||||
run_spec(__dirname, { parser: "graphql" });
|
||||
@@ -0,0 +1 @@
|
||||
query X($a: Int) @relay(meta: "{\"lowPri\": true}") { a }
|
||||
Reference in new issue
Block a user