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

Reporting API returns invalid JSON when label has backslash character #14882

Open
walokra opened this issue Sep 10, 2019 · 3 comments

Comments

@walokra
Copy link

commented Sep 10, 2019

When using Reporting API and i.a. Actions.getPageUrls report it returns JSON data which can be invalid if the label field has backslash. The backslash is correctly encoded to %5C in url and pageUrl elements but not in label. Matomo version 3.11.0.

e.g.
{"label":"\/search?p=0&q=\&sl=false","nb_visits":17,"nb_hits":17,"sum_time_spent":32,"nb_hits_with_time_generation":17,"min_time_generation":"0.244","max_time_generation":"0.549","sum_daily_nb_uniq_visitors":17,"avg_time_on_page":2,"bounce_rate":"0%","exit_rate":"0%","avg_time_generation":0.407,"url":"https:\/\/example.com\/search?p=0&q=%5C&sl=false","segment":"pageUrl==https%3A%2F%2Fexample.com%search%3Fp%3D0%26q%3D%5C%26sl%3Dfalse"}

@tsteur

This comment has been minimized.

Copy link
Member

commented Sep 10, 2019

Thanks, the JSON looks valid but the backslash in the label looks removed indeed.

@tsteur tsteur added the Bug label Sep 10, 2019

@tsteur tsteur added this to the Priority Backlog (Help wanted) milestone Sep 10, 2019

@walokra

This comment has been minimized.

Copy link
Author

commented Sep 11, 2019

Seems that Github removed the backslash in the JSON. Fixed it now and that JSON isn't valid. Backslashes in label field should be also escaped like forward slash is, i.e. "label":"/search?p=0&q=\&sl=false".

@matomo-org matomo-org deleted a comment Sep 11, 2019

@matomo-org matomo-org deleted a comment Sep 11, 2019

@matomo-org matomo-org deleted a comment Sep 11, 2019

@matomo-org matomo-org deleted a comment Sep 11, 2019

@matomo-org matomo-org deleted a comment Sep 11, 2019

@matomo-org matomo-org deleted a comment Sep 11, 2019

@tsteur

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

image

This is the JSON I'm getting. {"label":"54?4545=55&\\\u00a7$3434e<",

Just checking: Are you sure you're looking at the raw data of the API response? Tested with the same URL I'm getting this:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.