Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check domains validity when parsing network filters #4525

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
refactor: use replace instead of split then join
  • Loading branch information
seia-soto committed Dec 12, 2024
commit e63830cd33c9f5b8161dab66487108cbb16b8e0d
4 changes: 2 additions & 2 deletions packages/adblocker/src/filters/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1515,15 +1515,15 @@ export default class NetworkFilter implements IFilter {

if (this.domains !== undefined) {
if (this.domains.parts !== undefined) {
options.push(`domain=${this.domains.parts.split(',').join('|')}`);
options.push(`domain=${this.domains.parts.replace(/,/g, '|')}`);
} else {
options.push('domain=<hashed>');
}
}

if (this.denyallow !== undefined) {
if (this.denyallow.parts !== undefined) {
options.push(`denyallow=${this.denyallow.parts.split(',').join('|')}`);
options.push(`denyallow=${this.denyallow.parts.replace(/,/g, '|')}`);
} else {
options.push('denyallow=<hashed>');
}
Expand Down