Skip to content

Commit 0c8c13c

Browse files
committed
refactor: Use JSON.stringify for escapeJsonString to handle all JSON special characters
1 parent 0e5649e commit 0c8c13c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ const handleDotFields = object => {
209209
};
210210

211211
const escapeSqlString = value => value.replace(/'/g, "''");
212-
const escapeJsonString = value => value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
212+
const escapeJsonString = value => JSON.stringify(value).slice(1, -1);
213213

214214
const transformDotFieldToComponents = fieldName => {
215215
return fieldName.split('.').map((cmpt, index) => {

0 commit comments

Comments
 (0)