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

[Bug] URL decoding should not be used when saving regular expressions #22155

Open
4 tasks done
9joshua opened this issue Apr 23, 2024 · 0 comments
Open
4 tasks done

[Bug] URL decoding should not be used when saving regular expressions #22155

9joshua opened this issue Apr 23, 2024 · 0 comments
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member

Comments

@9joshua
Copy link
Contributor

9joshua commented Apr 23, 2024

What happened?

When creating a regex condition for a matching URL to trigger a Goal, the space character cannot be defined correctly.

For example, say I want to match any of these terms: "to-schools" "institutions" "youth programmes"
This should work regardless of whether URL decoding is used by Matomo when assessing the URL or not:
.*(to-schools|institutions|youth%20programmes|youth programmes)(.*|$)

It however does not work because URL decoding is applied to the expression when the Goal settings are saved. So the above regex is stored like this:
.*(to-schools|institutions|youth programmes|youth programmes)(.*|$)

Matomo does not URL decode the URL when it is evaluated, so the %20 is present in the URL being evaluated and therefore does not match the regex.

The only work around appears to be to add three wildcard characters so Matomo will find a match for %20...
.*(to-schools|institutions|youth.{3}programmes)(.*|$)

What should happen?

Matomo should not URL decode regex expressions when they are saved.

How can this be reproduced?

  1. Create a Goal with a regex match condition of: foo%20bar
  2. Save the Goal and view the saved version of the regex: foo bar
  3. Track a page like https://example.com?foo%20bar=1
  4. The Goal will not be triggered

Matomo version

5.0.3

PHP version

8.1

Server operating system

Linux

What browsers are you seeing the problem on?

Chrome

Computer operating system

Ubuntu

Relevant log output

No response

Validations

@9joshua 9joshua added Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member
Projects
None yet
Development

No branches or pull requests

1 participant