From 010984f70f45cfcfdc48d2d24f6d51951fa750a4 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Wed, 13 May 2020 11:48:56 +0200 Subject: [PATCH] [Discover] Encode context link filter part (#63831) * Encode filter part of the URI for context * Add functional test agent filter with whitespace --- .../angular/doc_table/components/table_row.ts | 18 +++++++++++------- .../apps/context/_context_navigation.js | 6 +++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts b/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts index 6feafe5e5e597..5fa37a5ac28eb 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts @@ -112,13 +112,17 @@ export function createTableRowDirective($compile: ng.ICompileService, $httpParam const globalFilters: any = getServices().filterManager.getGlobalFilters(); const appFilters: any = getServices().filterManager.getAppFilters(); const hash = $httpParamSerializer({ - _g: rison.encode({ - filters: globalFilters || [], - }), - _a: rison.encode({ - columns: $scope.columns, - filters: (appFilters || []).map(esFilters.disableFilter), - }), + _g: encodeURI( + rison.encode({ + filters: globalFilters || [], + }) + ), + _a: encodeURI( + rison.encode({ + columns: $scope.columns, + filters: (appFilters || []).map(esFilters.disableFilter), + }) + ), }); return `${path}?${hash}`; diff --git a/test/functional/apps/context/_context_navigation.js b/test/functional/apps/context/_context_navigation.js index b2312691599ba..42c67a37bd4bb 100644 --- a/test/functional/apps/context/_context_navigation.js +++ b/test/functional/apps/context/_context_navigation.js @@ -23,6 +23,10 @@ const TEST_COLUMN_NAMES = ['@message']; const TEST_FILTER_COLUMN_NAMES = [ ['extension', 'jpg'], ['geo.src', 'IN'], + [ + 'agent', + 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24', + ], ]; export default function({ getService, getPageObjects }) { @@ -56,7 +60,7 @@ export default function({ getService, getPageObjects }) { await browser.goBack(); await PageObjects.discover.waitForDocTableLoadingComplete(); const hitCount = await PageObjects.discover.getHitCount(); - expect(hitCount).to.be('1,556'); + expect(hitCount).to.be('522'); }); }); }