From 8c1bba317a027426e2ef5e9548144ac37bd465eb Mon Sep 17 00:00:00 2001
From: Philipp Kitzberger <typo3@kitze.net>
Date: Fri, 28 Jan 2022 17:10:37 +0100
Subject: [PATCH] [BUGFIX] Save+preview respects local PageTS

When pressing the save+preview button for a non-page record
the local PageTS is not being ignored anymore and leads the
user to the right page in the frontend.

Resolves: #96667
Releases: main, 11.5
Change-Id: Ibb3e9a549ca59bfd3a71649e2970d1d534c2c0e5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77377
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../backend/Classes/Controller/EditDocumentController.php       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
index 52ba97aaaee9..c54470f63515 100644
--- a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
+++ b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
@@ -423,7 +423,7 @@ class EditDocumentController
                 $this->R_URI = rtrim($this->R_URI, '&') .
                     HttpUtility::buildQueryString([
                         'showPreview' => true,
-                        'popViewId' => $this->getPreviewPageId(),
+                        'popViewId' => $parsedBody['popViewId'] ?? $this->getPreviewPageId(),
                     ], (empty($this->R_URL_getvars) ? '?' : '&'));
             }
             return new RedirectResponse($this->R_URI, 302);
-- 
GitLab