Fixing issue discovered by test case.
This commit is contained in:
parent
02a3b7425e
commit
ba2f6ee120
|
@ -99,11 +99,13 @@ module PostgresModule {
|
||||||
async function internalQuery(client: any, query: SqlQuery) {
|
async function internalQuery(client: any, query: SqlQuery) {
|
||||||
// need to handle a specific issue with json data types in postgres,
|
// need to handle a specific issue with json data types in postgres,
|
||||||
// new lines inside the JSON data will break it
|
// new lines inside the JSON data will break it
|
||||||
const matches = query.sql.match(JSON_REGEX)
|
if (query && query.sql) {
|
||||||
if (matches && matches.length > 0) {
|
const matches = query.sql.match(JSON_REGEX)
|
||||||
for (let match of matches) {
|
if (matches && matches.length > 0) {
|
||||||
const escaped = escapeDangerousCharacters(match)
|
for (let match of matches) {
|
||||||
query.sql = query.sql.replace(match, escaped)
|
const escaped = escapeDangerousCharacters(match)
|
||||||
|
query.sql = query.sql.replace(match, escaped)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue