tag-manager icon indicating copy to clipboard operation
tag-manager copied to clipboard

Editing existing Tag Manager variable results in double encoding request URI

Open Starker3 opened this issue 2 years ago • 5 comments

Refs L3-149

We received a report from a user that editing a Tag Manager Variable that was created with 4.3.1 after updating to 4.4.1 when the UI is in French results in a 400 Bad Request.

According to the user, it only happens if the Variable was created before the update and seems to be happening due to the space character (%20) being double encoded to %2520

They also say that commenting out this line: https://github.com/matomo-org/tag-manager/blob/4.x-dev/angularjs/manageVariable/edit.controller.js#L324 tempVariable.name = encodeURIComponent(tempVariable.name);

Works to resolve the issue.

When I tested the same in my testing instance (Commenting out the line) the URI was still being correctly URI encoded - so not sure if maybe this only gets encoded by the edit controller some of the time.

Starker3 avatar Sep 06 '21 04:09 Starker3

We likely won't be able to reproduce this one but we might just try to remove that line and test if things still work. We need to check though that the variable would be still encoded in the request when updating or creating a variable. It seems we don't have such an encoding for the name in manageTrigger/model.js and manageTag/model.js

tsteur avatar Sep 06 '21 04:09 tsteur

@tsteur Removing this line will result in variable name to be not encoded

Example with encoding Name: Matomo Configuration (1) Encoded Name in request: Matomo%20Configuration%20(1)

Example with encoding line removed Name: Matomo Configuration (1) Encoded Name in request: Matomo Configuration (1)

AltamashShaikh avatar Jan 21 '22 03:01 AltamashShaikh

@AltamashShaikh could you reproduce the initial issue? @Starker3 do you remember what word that was that caused the issue?

tsteur avatar Jan 21 '22 03:01 tsteur

Nope unable to reproduce this

AltamashShaikh avatar Jan 21 '22 04:01 AltamashShaikh

@tsteur @AltamashShaikh I'll check if I can find the original word that caused this issue. But what I do remember about this one is that the issue only occurs for variables that were created in French before a specific version. I.e. The variable has to be created to to a specific version, Matomo needs to then be updated and then the issue can be reproduced according to the user.

Starker3 avatar Jan 24 '22 20:01 Starker3