From 707775fe26ad36a090d0f7466a9079a61156db82 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon <54990055+sukhwinder33445@users.noreply.github.com> Date: Wed, 11 May 2022 14:45:31 +0200 Subject: [PATCH] Fix: Scheme and hostname prepended to col2 url in the address bar (#4777) --- public/js/icinga/loader.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index f038dc7c8..5e4e01bf8 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -806,9 +806,9 @@ } var autoSubmit = false; + var currentUrl = this.icinga.utils.parseUrl(req.$target.data('icingaUrl')); if (referrer.method === 'POST') { var newUrl = this.icinga.utils.parseUrl(req.url); - var currentUrl = this.icinga.utils.parseUrl(req.$target.data('icingaUrl')); if (newUrl.path === currentUrl.path && this.icinga.utils.arraysEqual(newUrl.params, currentUrl.params)) { autoSubmit = true; } @@ -828,9 +828,7 @@ if (!! contentSeparator) { var locationQuery = req.getResponseHeader('X-Icinga-Location-Query'); if (locationQuery !== null) { - var a = this.icinga.utils.getUrlHelper().cloneNode(true); - a.search = locationQuery ? '?' + locationQuery : ''; - + let url = currentUrl.path + (locationQuery ? '?' + locationQuery : ''); if (req.autosubmit || autoSubmit) { // Also update a form's action if it doesn't differ from the container's url var $form = $(referrer.forceFocus).closest('form'); @@ -840,12 +838,12 @@ if (formAction.path === currentUrl.path && this.icinga.utils.arraysEqual(formAction.params, currentUrl.params) ) { - $form.attr('action', a.href); + $form.attr('action', url); } } } - req.$target.data('icingaUrl', a.href); + req.$target.data('icingaUrl', url); this.icinga.history.replaceCurrentState(); }