Skip to content

Commit

Permalink
[TASK] Soften URI check
Browse files Browse the repository at this point in the history
  • Loading branch information
flossels committed Jun 28, 2021
1 parent 3ef19dc commit 0b9e1df
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Classes/Verdict/Redirect.php
Expand Up @@ -19,6 +19,7 @@
use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Http\RedirectResponse;
use TYPO3\CMS\Core\Http\Uri;
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand Down Expand Up @@ -152,8 +153,13 @@ private function shouldRedirect(): bool
}

// Redirect when URL is set and URL does not match actual URL
if (isset($this->configuration['url']) && strpos((string)$GLOBALS['TYPO3_REQUEST']->getUri(), $this->configuration['url']) === false) {
return true;
if (isset($this->configuration['url'])) {
$configUri = new Uri($this->configuration['url']);
$typo3Uri = $GLOBALS['TYPO3_REQUEST']->getUri();

if ($configUri->getHost() !== $typo3Uri->getHost() || $configUri->getScheme() !== $typo3Uri->getScheme() || $configUri->getPath() !== $typo3Uri->getPath()) {
return true;
}
}

// Do not redirect, when cookie is set and cookie value matches given language id
Expand Down

0 comments on commit 0b9e1df

Please sign in to comment.