From b9d710603cde132e898946364ead0c79a49f72b2 Mon Sep 17 00:00:00 2001
From: Benni Mack <benni@typo3.org>
Date: Tue, 27 Oct 2020 15:03:09 +0100
Subject: [PATCH] [BUGFIX] Do not re-set PreviewAspect when initializing TSFE

When the Admin Panel is activated, TSFE should not
override the frontendpreview aspect by default, as
the preview settings will never work otherwise.

Resolves: #92713
Releases: master, 10.4
Change-Id: I070fe49d5196f1ae2e8cc9feed3d16926f5d9728
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66314
Tested-by: Susanne Moog <look@susi.dev>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Susanne Moog <look@susi.dev>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack <benni@typo3.org>
---
 .../Classes/Middleware/TypoScriptFrontendInitialization.php    | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php b/typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php
index 23220656f48a..38d90936dc59 100644
--- a/typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php
+++ b/typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php
@@ -25,7 +25,6 @@ use TYPO3\CMS\Core\Context\Context;
 use TYPO3\CMS\Core\Routing\PageArguments;
 use TYPO3\CMS\Core\Site\Entity\Site;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Frontend\Aspect\PreviewAspect;
 use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
 use TYPO3\CMS\Frontend\Controller\ErrorController;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
@@ -74,8 +73,6 @@ class TypoScriptFrontendInitialization implements MiddlewareInterface
                 ['code' => PageAccessFailureReasons::INVALID_PAGE_ARGUMENTS]
             );
         }
-        $this->context->setAspect('frontend.preview', GeneralUtility::makeInstance(PreviewAspect::class));
-
         $frontendUser = $request->getAttribute('frontend.user');
         if (!$frontendUser instanceof FrontendUserAuthentication) {
             throw new \RuntimeException('The PSR-7 Request attribute "frontend.user" needs to be available as FrontendUserAuthentication object (as created by the FrontendUserAuthenticator middleware).', 1590740612);
-- 
GitLab