Response: Fix backwards compatibilty for `__CLOSE__`

If the redirect target changes, `__CLOSE__` has no effect

fixes #5081
This commit is contained in:
Johannes Meyer 2023-09-07 13:20:09 +02:00
parent bfda21b725
commit 36d4e6db29
1 changed files with 7 additions and 1 deletions

View File

@ -329,7 +329,13 @@ class Response extends Zend_Controller_Response_Http
// 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()