Skip to content

Commit

Permalink
[BUGFIX] Fix warning & mixed-mode handling
Browse files Browse the repository at this point in the history
- additional code cleanup
  • Loading branch information
twoldanski authored and lukaszuznanski committed Feb 5, 2024
1 parent 8df1678 commit ee3fffc
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Classes/XClass/ResourceLocalDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,22 @@ class ResourceLocalDriver extends LocalDriver
{
protected function determineBaseUrl(): void
{
$headlessMode = GeneralUtility::makeInstance(HeadlessMode::class)->withRequest($GLOBALS['TYPO3_REQUEST']);
$request = $GLOBALS['TYPO3_REQUEST'] ?? null;

if ((($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface
&& ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend()) ||
!$headlessMode->isEnabled()) {
if (!$request instanceof ServerRequestInterface) {
return;
}

$headlessMode = GeneralUtility::makeInstance(HeadlessMode::class)->withRequest($request);

if (!$headlessMode->isEnabled() || ApplicationType::fromRequest($request)->isBackend()) {
parent::determineBaseUrl();

return;
}

if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface &&
$this->hasCapability(ResourceStorage::CAPABILITY_PUBLIC)) {
$urlUtility = GeneralUtility::makeInstance(UrlUtility::class);
if ($this->hasCapability(ResourceStorage::CAPABILITY_PUBLIC)) {
$urlUtility = GeneralUtility::makeInstance(UrlUtility::class)->withRequest($request);
$this->configuration['baseUri'] = $urlUtility->getStorageProxyUrl();
}

Expand Down

0 comments on commit ee3fffc

Please sign in to comment.