summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/core
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2018-12-06 15:06:56 +0000
committerGéry Debongnie <ged@odoo.com>2018-12-06 15:16:32 +0000
commit6d3ada178f7caf6ea159b871648ca4c440c7845b (patch)
tree403c21f62c80ebdfc99e4eed0f1621424a4486e9 /addons/web/static/tests/core
parent84b976fb7c5f521549315b7b9c038e79f59f8eec (diff)
[FIX] web: prevent crash when searching for escaped strings
Recent works in the search view (in 12.0) on dynamic filters had an unfortunate effect: when the user tries to input escaped strings (for example "test" in custom filters, there was a crash. The reason is that the JS python parser (or more specifically, the tokenizer) was unable to parse that as a string. It worked before because the web client sent the raw string to the server. However, with dynamic filters, this is no longer the case, and we need to parse domains to be able to combine them. In this commit, we modify the tokenizer to be able to work with escaped strings. closes odoo/odoo#29324
Diffstat (limited to 'addons/web/static/tests/core')
-rw-r--r--addons/web/static/tests/core/py_utils_tests.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/addons/web/static/tests/core/py_utils_tests.js b/addons/web/static/tests/core/py_utils_tests.js
index d59fd30f957..be5760fc6c7 100644
--- a/addons/web/static/tests/core/py_utils_tests.js
+++ b/addons/web/static/tests/core/py_utils_tests.js
@@ -1254,6 +1254,13 @@ QUnit.module('core', function () {
assert.checkAST(expr);
});
+ QUnit.test("parse escaped quoted strings", function (assert) {
+ assert.expect(2);
+
+ assert.checkAST(`'\"'`, "a string containing \"");
+ assert.checkAST(`'\'`, "a string containing \'");
+ });
+
QUnit.module('pyutils (_normalizeDomain)');
QUnit.assert.checkNormalization = function (domain, normalizedDomain) {