Closed lionel-rowe closed 2 years ago
The default domain matching matches when the domain string is found anywhere within the URL, not only when it's the hostname.
Chrome 97.0.4692.99 on Windows 10
Steps to reproduce the behavior:
example.com
body { background-color: fuchsia; }
www.google.com
Background is default (white)
Background is fuchsia
I'm guessing the problem is here: https://github.com/ankit/stylebot/blob/060f566e49c83847d6c4f7e1b87156d91de63a73/src/background/utils.ts#L34-L37
Replacing that indexOf check with something like new URL(url).hostname === new URL(`https://${subUrls[i].trim()}`).hostname might do the trick.
indexOf
new URL(url).hostname === new URL(`https://${subUrls[i].trim()}`).hostname
I just found the same thing, hope to see your PR get merged!
Describe the bug
The default domain matching matches when the domain string is found anywhere within the URL, not only when it's the hostname.
Browser
Chrome 97.0.4692.99 on Windows 10
To Reproduce
Steps to reproduce the behavior:
example.com
)body { background-color: fuchsia; }
as a Stylebot rule for that pagewww.google.com
)Expected behavior
Background is default (white)
Actual behavior
Background is fuchsia
Additional context
I'm guessing the problem is here: https://github.com/ankit/stylebot/blob/060f566e49c83847d6c4f7e1b87156d91de63a73/src/background/utils.ts#L34-L37
Replacing that
indexOf
check with something likenew URL(url).hostname === new URL(`https://${subUrls[i].trim()}`).hostname
might do the trick.