getAttribute('normalizedParams'); if (self::$isProcessingUrl || !$normalizedParams) { return; } $resource = $event->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; } // @todo: The "dynamic" event registration in both FE and BE RequestHandler's plus this // ugly late Request dependency resolving within FAL should be refactored by // incorporating Request dependency into FAL URI generation in a more direct way. $event->setPublicUrl($normalizedParams->getSitePath() . $originalUrl); } finally { self::$isProcessingUrl = false; } } private function isLocalResource(ResourceInterface $resource): bool { return $resource->getStorage()->getDriverType() === 'Local'; } }