fix(regex): Prevent converting JSON in queries into placeholders

- When a JSON string is entered as part of a query, rather than a parameter, it is assumed to define a named placeholder - this will check for quotations and ignore it
This commit is contained in:
Linden committed 2021-10-18 01:51:37 +11:00
1 parent a46b586832
commit 00f9d0449c
1 file changed
+2 -2
+2 -2
View File
@@ -1,5 +1,5 @@
diff --git a/node_modules/named-placeholders/index.js b/node_modules/named-placeholders/index.js
index 527d723..1ac61d5 100644
index 527d723..f63ce28 100644
--- a/node_modules/named-placeholders/index.js
+++ b/node_modules/named-placeholders/index.js
@@ -3,7 +3,7 @@
@@ -7,7 +7,7 @@ index 527d723..1ac61d5 100644
// License: https://github.com/mscdex/node-mariasql/blob/master/LICENSE
-const RE_PARAM = /(?:\?)|(?::(\d+|(?:[a-zA-Z][a-zA-Z0-9_]*)))/g,
+const RE_PARAM = /(?:\?)|(?:[:@](\d+|(?:[a-zA-Z][a-zA-Z0-9_]*)))/g,
+const RE_PARAM = /(?:\?)|(?:(?<!["'])[:@](\d+|(?:[a-zA-Z][a-zA-Z0-9_]*)))/g,
DQUOTE = 34,
SQUOTE = 39,
BSLASH = 92;