From 230dd44574afb1e33ceead8ff3130a99af21390b Mon Sep 17 00:00:00 2001 From: Helmut Hummel <info@helhum.io> Date: Tue, 11 Oct 2016 15:05:17 +0200 Subject: [PATCH] [BUGFIX] Bind the cHash to the id of the "real" page If a link to a mount point or a shortcut is created, the id argument in the url points to the id of the real page, where the mount or the shortcut points to. This is why we need to take the id of the final page to be hashed and not the one used to generate the link. We also need to move cHash calculation below shortcut resolving. Resolves: #78238 Releases: master, 7.6, 6.2 Change-Id: I96c4305c6d769a5851c17d6fdcba3cd7584fc3ec Reviewed-on: https://review.typo3.org/50184 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Markus Klein <markus.klein@typo3.org> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Tested-by: Markus Klein <markus.klein@typo3.org> Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de> Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de> --- .../ContentObject/ContentObjectRenderer.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 608b87dab7dd..87d2342f0cf3 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -5931,16 +5931,6 @@ class ContentObjectRenderer if ($addQueryParams === '&' || $addQueryParams[0] !== '&') { $addQueryParams = ''; } - if ($conf['useCacheHash']) { - $params = $tsfe->linkVars . $addQueryParams . '&id=' . $linkDetails['pageuid']; - if (trim($params, '& ') != '') { - /** @var $cacheHash CacheHashCalculator */ - $cacheHash = GeneralUtility::makeInstance(CacheHashCalculator::class); - $cHash = $cacheHash->generateForParameters($params); - $addQueryParams .= $cHash ? '&cHash=' . $cHash : ''; - } - unset($params); - } $targetDomain = ''; $currentDomain = (string)$this->getEnvironmentVariable('HTTP_HOST'); // Mount pages are always local and never link to another domain @@ -5982,6 +5972,16 @@ class ContentObjectRenderer $targetDomain = ''; } } + if ($conf['useCacheHash']) { + $params = $tsfe->linkVars . $addQueryParams . '&id=' . $page['uid']; + if (trim($params, '& ') != '') { + /** @var $cacheHash CacheHashCalculator */ + $cacheHash = GeneralUtility::makeInstance(CacheHashCalculator::class); + $cHash = $cacheHash->generateForParameters($params); + $addQueryParams .= $cHash ? '&cHash=' . $cHash : ''; + } + unset($params); + } $absoluteUrlScheme = 'http'; // URL shall be absolute: if (isset($conf['forceAbsoluteUrl']) && $conf['forceAbsoluteUrl'] || $page['url_scheme'] > 0) { -- GitLab