Skip to content

Commit

Permalink
fix: Bypass CDN url generation for online media file resources
Browse files Browse the repository at this point in the history
  • Loading branch information
tweis committed Oct 22, 2024
1 parent 11a6332 commit 89bca06
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Classes/EventListener/AddCdnToResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use TYPO3\CMS\Core\Resource\Driver\LocalDriver;
use TYPO3\CMS\Core\Resource\Event\GeneratePublicUrlForResourceEvent;
use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\OnlineMediaHelperRegistry;
use TYPO3\CMS\Core\Resource\ProcessedFile;
use TYPO3\CMS\Core\Resource\ResourceInterface;
use TYPO3\CMS\Core\Resource\ResourceStorageInterface;
Expand Down Expand Up @@ -53,8 +54,17 @@ public function __invoke(GeneratePublicUrlForResourceEvent $event): void
return;
}

if (($resource->getStorage()->getCapabilities(
) & ResourceStorageInterface::CAPABILITY_PUBLIC) !== ResourceStorageInterface::CAPABILITY_PUBLIC) {
if (
($resource->getStorage()->getCapabilities() & ResourceStorageInterface::CAPABILITY_PUBLIC)
!== ResourceStorageInterface::CAPABILITY_PUBLIC
) {
return;
}

if (
$resource instanceof File &&
GeneralUtility::makeInstance(OnlineMediaHelperRegistry::class)->getOnlineMediaHelper($resource) !== false
) {
return;
}

Expand Down

0 comments on commit 89bca06

Please sign in to comment.