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

PAC File interpretation of shExpMatch return wrong results #571

Open
JGRSAGA opened this issue Feb 16, 2024 · 0 comments
Open

PAC File interpretation of shExpMatch return wrong results #571

JGRSAGA opened this issue Feb 16, 2024 · 0 comments

Comments

@JGRSAGA
Copy link

JGRSAGA commented Feb 16, 2024

We are running into issues with PAC Files that uses the shExpMatch Function and uses the Brackets '(' as the first character in the expression.
If we use "shExpMatch(host,"(.example.com|example.com)") the result of a test against "my host.example.com" as the host will return "false" even if all other PAC-File checkers are return true.
The reason is, that the expression resulting from the shExpMatch Function will use the first '(' as a Literal and escape this with (.
The result will then be ^(.
.example.com|example.com)$

As a quick workaround I tested
// If Expression starts with '(', remove leading and trailing Brackets

    if (shExp[0] === "(") {
        shExp = shExp.substring(1,shExp.length-1);
    }

which seems to work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant