From 390f2b1bb884a5b09f01fccd59a36e3093f84dd2 Mon Sep 17 00:00:00 2001 From: diosmosis <benaka@piwik.pro> Date: Sun, 4 Oct 2015 03:42:13 -0700 Subject: [PATCH] Regression: columns query parameter is never urldecoded in PHP so it cannot be encoded in JS. --- plugins/CoreHome/angularjs/history/history.service.js | 7 ++++++- tests/UI/specs/UIIntegration_spec.js | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/CoreHome/angularjs/history/history.service.js b/plugins/CoreHome/angularjs/history/history.service.js index bcaaa6a598..8b4fac7044 100644 --- a/plugins/CoreHome/angularjs/history/history.service.js +++ b/plugins/CoreHome/angularjs/history/history.service.js @@ -67,7 +67,12 @@ searchObject[name] = searchObject[name][searchObject[name].length - 1]; } - searchString.push(name + '=' + encodeURIComponent(searchObject[name])); + var value = searchObject[name]; + if (name != 'columns') { // the columns query parameter is not urldecoded in PHP code. TODO: this should be fixed in 3.0 + value = encodeURIComponent(value); + } + + searchString.push(name + '=' + value); } searchString = searchString.join('&'); diff --git a/tests/UI/specs/UIIntegration_spec.js b/tests/UI/specs/UIIntegration_spec.js index 1334a9dd19..d1f7ac80ae 100644 --- a/tests/UI/specs/UIIntegration_spec.js +++ b/tests/UI/specs/UIIntegration_spec.js @@ -81,7 +81,8 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik? // visitors pages it('should load visitors > overview page correctly', function (done) { expect.screenshot("visitors_overview").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) { - page.load("?" + urlBase + "#" + generalParams + "&module=VisitsSummary&action=index"); + // use columns query param to make sure columns works when supplied in URL fragment + page.load("?" + urlBase + "#" + generalParams + "&module=VisitsSummary&action=index&columns=nb_visits,nb_actions"); }, done); }); -- GitLab