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

Goal name is truncated when ampersand is present #20174

Open
marcusosterberg opened this issue Jan 9, 2023 · 4 comments
Open

Goal name is truncated when ampersand is present #20174

marcusosterberg opened this issue Jan 9, 2023 · 4 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.

Comments

@marcusosterberg
Copy link
Contributor

Expected Behavior

I guess goal names / titles should accept a & character

Current Behavior

Everything after the "&" is scrapped when saving a goal.
My example:
2. Mikro: Klickar till etjänsten "Felanmälan&
When I try:
2. Mikro: Klickar till etjänsten "Felanmälan&syn"

Steps to Reproduce (for Bugs)

The demo environment do not allow me to enter goals.

Context

I'm trying to have ampersands and other special characters in the name of a goal

Your Environment

  • Matomo Version: 4.13.0

  • PHP Version: 7.4.32

  • Server Operating System: Ubuntu LTS

  • Browser: Brave (Chromium)

  • Operating System: Macos 12.6.2

@marcusosterberg marcusosterberg 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 Jan 9, 2023
@sgiehl
Copy link
Member

sgiehl commented Jan 9, 2023

Hi @marcusosterberg,

The problem actually is not the ampersand. Goal names are limited to 50 chars. But special html chars like " or & are stored html encoded as " or &.
So goal names that reaches that limit (after encoding the html chars) are truncated to 50 chars. This currently might also break those encoded characters as they might get cut off.

I guess in general we should store those names unencoded in that database and ensure the name is encoded whereever it is used. Might be related or solvable with #11786

@sgiehl sgiehl added Bug For errors / faults / flaws / inconsistencies etc. and removed 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 Jan 9, 2023
@sgiehl sgiehl added this to the For Prioritization milestone Jan 9, 2023
@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/goals-autocorrect-to-html-entities/49904/3

@heurteph-ei
Copy link

Hi @sgiehl
Do you know if the fact the goal regular expression (in goal definition) could also be impacted by this bad bahaviour? (URL escaping of & char...). See https://forum.matomo.org/t/goals-autocorrect-to-html-entities/49904

@sgiehl
Copy link
Member

sgiehl commented Mar 20, 2023

@heurteph-ei Kind of a similar issue. The content is stored sanitized, but seems it's not unsanitized before being displayed again.
I've created #20495 to fix this in Matomo 5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

5 participants