Browse Source

Ignore escaped double quotes within strings

master
Mel O'Hagan 4 years ago
parent
commit
334d9a956d
  1. 2
      packages/server/src/integrations/mongodb.ts
  2. 4
      packages/server/src/integrations/tests/mongo.spec.js

2
packages/server/src/integrations/mongodb.ts

@ -123,7 +123,7 @@ module MongoDBModule {
let i = 0
let startIndex = 0
for (let c of params) {
if (c === '"') {
if (c === '"' && (i > 0 && params[i-1] !== '\\')) {
inQuotes = !inQuotes
}
if (c === "{" && !inQuotes) {

4
packages/server/src/integrations/tests/mongo.spec.js

@ -289,7 +289,7 @@ describe("MongoDB Integration", () => {
},
{
"upsert": true,
"extra": "ad{d"
"extra": "ad\\"{\\"d"
}`,
extra: { collection: "testCollection", actionTypes: "updateOne" },
}
@ -317,7 +317,7 @@ describe("MongoDB Integration", () => {
})
expect(args[2]).toEqual({
upsert: true,
extra: "ad{d"
extra: "ad\"{\"d"
})
})
})

Loading…
Cancel
Save