Skip to content

Commit

Permalink
Response: Fix backwards compatibilty for __CLOSE__
Browse files Browse the repository at this point in the history
If the redirect target changes, `__CLOSE__` has no effect

fixes #5081
  • Loading branch information
nilmerg committed Sep 7, 2023
1 parent bfda21b commit 36d4e6d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion library/Icinga/Web/Response.php
Expand Up @@ -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()
Expand Down

0 comments on commit 36d4e6d

Please sign in to comment.