getResource(); if (!$this->isLocalResource($resource)) { return; } // Before calling getPublicUrl, we set the static property to true to avoid to be called in a loop self::$isProcessingUrl = true; try { $resource = $event->getResource(); $originalUrl = $event->getStorage()->getPublicUrl($resource); if (!$originalUrl || PathUtility::hasProtocolAndScheme($originalUrl)) { return; } $absRefPrefix = GeneralUtility::makeInstance(FrontendUrlPrefix::class)->getUrlPrefix($request); $event->setPublicUrl($absRefPrefix . $originalUrl); } finally { self::$isProcessingUrl = false; } } private function isLocalResource(ResourceInterface $resource): bool { return $resource->getStorage()->getDriverType() === 'Local'; } }