diff --git a/local/modules/TheliaSmarty/Template/Plugins/Assets.php b/local/modules/TheliaSmarty/Template/Plugins/Assets.php index cf69c01b49..1567bb9633 100644 --- a/local/modules/TheliaSmarty/Template/Plugins/Assets.php +++ b/local/modules/TheliaSmarty/Template/Plugins/Assets.php @@ -91,7 +91,11 @@ public function renderSvg($params, \Smarty_Internal_Template $template) return false; } - $svg = file_get_contents($path); + try { + $svg = file_get_contents($path); + } catch (\ErrorException $exception) { + $svg = file_get_contents(THELIA_WEB_DIR.$path); + } $matches = []; preg_match('//', $svg, $matches); diff --git a/local/modules/TheliaSmarty/Template/Plugins/Encore.php b/local/modules/TheliaSmarty/Template/Plugins/Encore.php index 477fb067a9..6d236be9f5 100644 --- a/local/modules/TheliaSmarty/Template/Plugins/Encore.php +++ b/local/modules/TheliaSmarty/Template/Plugins/Encore.php @@ -93,15 +93,20 @@ public function functionModuleAsset($args) public function getWebpackManifestFile($args): string { - $urlTool = URL::getInstance(); - $file = $args['file']; if (!$file) { return ''; } if (isset($this->packages['manifest'])) { - return $urlTool->absoluteUrl($this->packages['manifest']->geturl($file)); + // Take absolute url if available else take relative path + $manifestPath = URL::getInstance()->absoluteUrl($this->packages['manifest']->geturl($file)); + $fileHeaders = @get_headers($manifestPath); + if (!$fileHeaders || (int) substr($fileHeaders[0], 9, 3) >= 400) { + $manifestPath = $this->packages['manifest']->geturl($file); + } + + return $manifestPath; } return '';