Pull request: 3201 use backslash to escape quotes in the client name
Closes #3201
Squashed commit of the following:
commit 43d2b967a4d13ff4556b2d9a7d6281b2a8be0895
Merge: 36eeb1bc 784bc318
Author: Ildar Kamalov <ik@adguard.com>
Date: Mon Aug 16 17:29:06 2021 +0300
Merge branch 'master' into 3201-escape-quotes
commit 36eeb1bc9862181a1cc3108300c6a12a9d913057
Author: Ildar Kamalov <ik@adguard.com>
Date: Mon Aug 16 15:56:15 2021 +0300
client: multiple escape
commit e7c19ddb1a5041447d9612783415ba21fcad802e
Author: Ildar Kamalov <ik@adguard.com>
Date: Mon Aug 16 12:04:43 2021 +0300
client: use backslash to escape quotes in the client name
This commit is contained in:
parent
784bc318ca
commit
42b2c3ab85
|
@ -638,7 +638,11 @@ export const toggleBlocking = (
|
|||
};
|
||||
|
||||
export const toggleBlockingForClient = (type, domain, client) => {
|
||||
const baseRule = `||${domain}^$client='${client.replace(/'/g, '/\'')}'`;
|
||||
const escapedClientName = client.replace(/'/g, '\\\'')
|
||||
.replace(/"/g, '\\"')
|
||||
.replace(/,/g, '\\,')
|
||||
.replace(/\|/g, '\\|');
|
||||
const baseRule = `||${domain}^$client='${escapedClientName}'`;
|
||||
const baseUnblocking = `@@${baseRule}`;
|
||||
|
||||
return toggleBlocking(type, domain, baseRule, baseUnblocking);
|
||||
|
|
Loading…
Reference in New Issue