From 36d4e6db2985c86b798e7c922931d0ab2806f42a Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 7 Sep 2023 13:20:09 +0200 Subject: [PATCH] Response: Fix backwards compatibilty for `__CLOSE__` If the redirect target changes, `__CLOSE__` has no effect fixes #5081 --- library/Icinga/Web/Response.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Web/Response.php b/library/Icinga/Web/Response.php index 6dcd2dcaf9..fd9124b814 100644 --- a/library/Icinga/Web/Response.php +++ b/library/Icinga/Web/Response.php @@ -329,7 +329,13 @@ protected function prepare() // TODO: Compatibility only. Remove once v2.14 is out. $targetId = $request->getHeader('X-Icinga-Container'); - if ($request->isPost() && $targetId === 'col2' && $request->getHeader('X-Icinga-Col2-State')) { + $redirectTargetId = $this->getHeader('X-Icinga-Container', true) ?? $targetId; + if ($request->isPost() + && ! $this->getRerenderLayout() + && $targetId === 'col2' + && $redirectTargetId === $targetId + && $request->getHeader('X-Icinga-Col2-State') + ) { $col1State = Url::fromPath($request->getHeader('X-Icinga-Col1-State')); $col2State = Url::fromPath($request->getHeader('X-Icinga-Col2-State')); if ($col2State->getPath() !== $redirectUrl->getPath()