From 5db962e9c7298b7ab2572be26b0f6964c0e7751b 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
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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/+/73193
Tested-by: Lorenz Ulrich <lorenz.ulrich@visol.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Rémy DANIEL <dogawaf@no-log.org>
Reviewed-by: Rémy DANIEL <dogawaf@no-log.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
---
 .../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 a387a0cc001b..faf8730276d6 100644
--- a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
+++ b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
@@ -392,7 +392,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