Skip to content

Commit d006a42

Browse files
DvirDukhangkorland
andauthored
escape strings (#52)
* escape strings * Update graph.js * Update redisGraphAPITest.js Co-authored-by: Guy Korland <[email protected]>
1 parent 27a38ab commit d006a42

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/graph.js

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class Graph {
6363
let paramType = typeof paramValue;
6464
if (paramType == "string") {
6565
let strValue = "";
66+
paramValue = paramValue.replace(/[\\"']/g, '\\$&');
6667
if (paramValue[0] != '"') strValue += '"';
6768
strValue += paramValue;
6869
if (paramValue[paramValue.length - 1] != '"') strValue += '"';

test/redisGraphAPITest.js

+1
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ describe("RedisGraphAPI Test", () => {
412412
[1, 2, 3],
413413
["1", "2", "3"],
414414
null,
415+
'test"abc'
415416
];
416417
let promises = [];
417418
for (var i = 0; i < params.length; i++) {

0 commit comments

Comments
 (0)