mirror of
https://github.com/NaN-tic/sao-base.git
synced 2023-12-14 03:13:01 +01:00
Escape backslash in domain parser
Backslash is the escape key so it must be escaped. issue4471 review6041002
This commit is contained in:
parent
cc335e75e5
commit
7ad8438017
|
@ -1180,6 +1180,9 @@
|
|||
if (typeof value != 'string') {
|
||||
return value;
|
||||
}
|
||||
if (value.contains('\\')) {
|
||||
value = value.replace(new RegExp('\\\\', 'g'), '\\\\');
|
||||
}
|
||||
if (value.contains('"')) {
|
||||
value = value.replace(new RegExp('"', 'g'), '\\"');
|
||||
}
|
||||
|
|
|
@ -1014,7 +1014,8 @@
|
|||
[
|
||||
['test', 'test'],
|
||||
['foo bar', '"foo bar"'],
|
||||
['"foo"', '\\\"foo\\\"']
|
||||
['"foo"', '\\\"foo\\\"'],
|
||||
['foo\\bar', 'foo\\\\bar']
|
||||
].forEach(function(test) {
|
||||
var value = test[0];
|
||||
var result = test[1];
|
||||
|
|
Loading…
Reference in a new issue