Pattern that match the URL is not rigorous, resulting in `@match` may not be correctly matched · Issue #249 · quoid/userscripts · GitHub
Skip to content

Pattern that match the URL is not rigorous, resulting in @match may not be correctly matched #249

Description

@ACTCD

System Information:

macOS or iOS version: Unrelated
Userscripts version: v4.1.0, v.1.1.0
Safari version: Unrelated
Is this issue related to script injection? Seemingly
Did the test script (pasted above) successfully run on your machine? Yes

When I discovered this metadata:
// @match *://www.google.com/*
Can't match the userscript when browser open URL like this:
https://www.google.com/preferences?prev=https://www.google.com/

I spent a lot of time to read the source code, and I think I found where the problem.


I made an online demonstration to show how it matches the web page URL and what kind of problems.
I believe it is obvious:
https://regex101.com/r/xs43bS/1

At first I thought it was a @match matching problem, but by looking at the source code, because this occurred in the webpage URL matching stage, I assumed that it should also affect @include and other metadata.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions