Commit 385bd0b1 authored by Tristan Cavelier's avatar Tristan Cavelier

BACKSLASH dist/jio-latest

parent 7bb9e8a4
...@@ -7435,7 +7435,16 @@ return new Parser; ...@@ -7435,7 +7435,16 @@ return new Parser;
return new Query(key_schema); return new Query(key_schema);
} }
if (typeof object === "string") { if (typeof object === "string") {
object = parseStringToObject(object); try {
object = parseStringToObject(object);
} catch (error) {
if (error.hash && error.hash.expected &&
error.hash.expected.length === 1 &&
error.hash.expected[0] === "'QUOTE'") {
return new query_class_dict.simple({value: object});
}
throw error;
}
} }
if (typeof (object || {}).type === "string" && if (typeof (object || {}).type === "string" &&
query_class_dict[object.type]) { query_class_dict[object.type]) {
...@@ -7445,6 +7454,10 @@ return new Parser; ...@@ -7445,6 +7454,10 @@ return new Parser;
"Argument 1 is not a search text or a parsable object"); "Argument 1 is not a search text or a parsable object");
}; };
function sanitizeQueryValue(value) {
return value.replace(/((?:\\\\)*)\\$/, "$1");
}
function objectToSearchText(query) { function objectToSearchText(query) {
var i = 0, var i = 0,
query_list = null, query_list = null,
...@@ -7453,7 +7466,8 @@ return new Parser; ...@@ -7453,7 +7466,8 @@ return new Parser;
common_key = ""; common_key = "";
if (query.type === "simple") { if (query.type === "simple") {
return (query.key ? query.key + ": " : "") + return (query.key ? query.key + ": " : "") +
(query.operator || "") + ' "' + query.value + '"'; (query.operator || "") +
' "' + sanitizeQueryValue(query.value) + '"';
} }
if (query.type === "complex") { if (query.type === "complex") {
query_list = query.query_list; query_list = query.query_list;
...@@ -7484,7 +7498,7 @@ return new Parser; ...@@ -7484,7 +7498,7 @@ return new Parser;
for (i = 0; i < query_list.length; i += 1) { for (i = 0; i < query_list.length; i += 1) {
string_list.push( string_list.push(
(query_list[i].operator || "") + (query_list[i].operator || "") +
' "' + query_list[i].value + '"' ' "' + sanitizeQueryValue(query_list[i].value) + '"'
); );
} }
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment