1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-02 23:57:10 +02:00

Normalize non-ASCII characters in :matches-path() argument

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2369
This commit is contained in:
Raymond Hill 2023-03-26 15:37:15 -04:00
parent c8af55e27a
commit a8a46c4593
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 6 additions and 2 deletions

View File

@ -192,7 +192,9 @@ class PSelectorMatchesMediaTask extends PSelectorTask {
class PSelectorMatchesPathTask extends PSelectorTask {
constructor(task) {
super();
this.needle = regexFromString(task[1]);
this.needle = regexFromString(
task[1].replace(/\P{ASCII}/gu, s => encodeURIComponent(s))
);
}
transpose(node, output) {
if ( this.needle.test(self.location.pathname + self.location.search) ) {

View File

@ -161,7 +161,9 @@ class PSelectorMatchesMediaTask extends PSelectorTask {
class PSelectorMatchesPathTask extends PSelectorTask {
constructor(task) {
super();
this.needle = regexFromString(task[1]);
this.needle = regexFromString(
task[1].replace(/\P{ASCII}/gu, s => encodeURIComponent(s))
);
}
transpose(node, output) {
if ( this.needle.test(self.location.pathname + self.location.search) ) {