Fix: Scheme and hostname prepended to col2 url in the address bar (#4777)

This commit is contained in:
Sukhwinder Dhillon 2022-05-11 14:45:31 +02:00 committed by GitHub
parent 2a80e8bca6
commit 707775fe26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -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();
}