-
Notifications
You must be signed in to change notification settings - Fork 101
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
Network filter toString fix #3681
Conversation
I think it's this case:
Can you share an example of filter where you encountered the issue? |
checkToString('@@||foo.com', '@@||foo.com^'); | ||
checkToString('@@||foo.com|', '@@||foo.com^|'); | ||
checkToString('@@||foo.com|', '@@||foo.com^'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the semantics of this is a bit different now. Although I think it might not be 100% correct in the previous case either. I vaguely remember that this case was a little bit hacky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uBlock Origin team replied me with a clarification: |
is used to match start/end of address.
||hostname^| => http://example.com/ & not http://example.com/blablabla
Many thanks to @ ghajini from uBO.
If I remember correctly this combination of flags was used in order to implicitly detect cases like
Maybe the better way would be to introduce a flag for that and remove the hack. It would also allow to have a 100% correct |
I'm leaving a note during investigation on Also: However, there's actually a use of |
If we are going to process Also, see #3681 (comment) |
* feat: modifier replacer for NetworkFilter.toString To make minimal performance impact on current codes using adblocker library, I chose to use Array.prototype.map function instead of putting `if` statements or using empty proxying function: `(str: text) => str` as default value. refs #3693 * chore: fix types use `as const` keyword * chore(test): fix test output refs #3681 * fix(test): test expectation to match latest commit refs #3681
I've run into a weird edge case.
NetworkFilter#toString()
adds a right anchor to filters ending with a separator.This may potentially be correct, but some other part of our toolchain (abp2dnr) does not handle the right anchors and thus ends up with a broken filter (as DNR does not support right anchor either, afaict).
Anyways, resulting syntax
^|
is extremely rare, I found only one filter using it in both uAssets and Easylist.Can we make this change?