@OliverIost opened this Issue on May 17th 2022

Expected Behavior

curl "https://www.mydomain.de/matomo/?module=API&idSite=1&format=json&token_auth=XXX&method=Actions.getOutlink&outlinkUrl=https%3A%2F%2Fwww.testdomain.de%2Ftest%2F%3Ftest%3D321%26test2%3D13&period=day&date=2022-04-26"

(and I know that this was called on the day asked) should return something like


Current Behavior

Return of

Possible Solution

Quick fix: I found that the link itself is saved as
in the action database but in matomo/plugins/Actions/API.php->getFilterPageDatatableSearch the search comes as
https://www.testdomain.de/test/?test=321&test2=13 so nothing can be found.

Cause I do not know where and what exactly is en/decoded, I only added these lines directly before the last return in
protected function getFilterPageDatatableSearch($callBackParameters, $search, $actionType)
in matomo/plugins/Actions/API.php

if(isset($searchTree[1]) && strpos($searchTree[1],'&')!==false && strpos($searchTree[1],'&')===false) {

Now it works for me.

Your Environment

  • Matomo Version: 4.10
  • PHP Version: 7.4.29
  • Server Operating System: Debian 9.2
@bx80 commented on May 17th 2022 Contributor

Hi @OliverIost, thanks for reporting this and providing a quick fix. I can recreate the issue and confirm that after the quick fix is applied getOutlink API calls with ampersands in the URL are correctly returned. :+1:

I'll mark this as a bug so our product team can prioritize it.

(github markdown has encoded the ampersands in the provided code, here is a fixed version for reference)

if (isset($searchTree[1]) &&
    strpos($searchTree[1],'&') !== false &&
    strpos($searchTree[1],'&') === false) {
@heurteph-ei commented on May 18th 2022

Shouldn't the data (in the database) be stored unencoded?
Most of the time, data in DB should be as raw as possible (dates in UTC, urls not encoded, HTML not encoded, etc.)

@bx80 commented on May 18th 2022 Contributor

Shouldn't the data (in the database) be stored unencoded?

:+1: The root cause of the problem may well be that the URL parameter ampersands are being stored encoded when they should be raw. This is something that should be considered when working on this issue.

Powered by GitHub Issue Mirror