From c2ac152d4bb3f9c377067a0ae7d4e15e473fa19d Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Tue, 29 Aug 2023 21:04:52 +0100 Subject: [PATCH] Use browser APIs for URL manipulation --- view/adminhtml/templates/grid.phtml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/view/adminhtml/templates/grid.phtml b/view/adminhtml/templates/grid.phtml index 2d3597f..21768ca 100644 --- a/view/adminhtml/templates/grid.phtml +++ b/view/adminhtml/templates/grid.phtml @@ -405,11 +405,11 @@ $rows = $grid->getRows(); }, getFormUriEncoded(form) { - const url = form.action; - const encodedFields = Array.from(form.elements) - .map(input => encodeURIComponent(input.name) + '=' + encodeURIComponent(input.value)) - .join('&'); - return url + (url.includes('?') ? '&' : '?') + encodedFields; + const url = new URL(form.action); + Array.from(form.elements).forEach( + input => url.searchParams.set(input.name, input.value) + ); + return url.toString(); }, updateGrid(url) {