Ignore escaped double quotes within strings

This commit is contained in:
Mel O'Hagan 2022-08-10 10:57:42 +01:00
parent f7c816bce9
commit 334d9a956d
2 changed files with 3 additions and 3 deletions

View File

@ -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) {

View File

@ -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"
})
})
})