domain_parser must escape when quoting '"'
issue4247 review7651002
This commit is contained in:
1 parent
ec49d4ea99
commit
49296b514b
2 files changed
+21
No files matched your search
@@ -1003,6 +1003,9 @@
|
||||
if (typeof value != 'string') {
|
||||
return value;
|
||||
}
|
||||
if (value.contains('"')) {
|
||||
value = value.replace(new RegExp('"', 'g'), '\\"');
|
||||
}
|
||||
var tests = [':', ' ', '(', ')'].concat(this.OPERATORS);
|
||||
for (var i = 0; i < tests.length; i++) {
|
||||
var test = tests[i];
|
||||
|
||||
@@ -919,6 +919,9 @@
|
||||
['Name: = Name: Doe', [
|
||||
['Name', '=', null],
|
||||
['Name', null, 'Doe']
|
||||
]],
|
||||
['Name: \\"foo\\"', [
|
||||
['Name', null, '"foo"']
|
||||
]]
|
||||
].forEach(function(test) {
|
||||
var value = test[0];
|
||||
@@ -966,6 +969,21 @@
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('DomainParser.quote', function() {
|
||||
var parser = new Sao.common.DomainParser();
|
||||
|
||||
[
|
||||
['test', 'test'],
|
||||
['foo bar', '"foo bar"'],
|
||||
['"foo"', '\\\"foo\\\"']
|
||||
].forEach(function(test) {
|
||||
var value = test[0];
|
||||
var result = test[1];
|
||||
QUnit.ok(Sao.common.compare(parser.quote(value), result),
|
||||
'quote(' + JSON.stringify(value) + ')');
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('DomainParser.split_target_value', function() {
|
||||
var parser = new Sao.common.DomainParser();
|
||||
|
||||
|
||||
Reference in new issue
Block a user