X-Git-Url: https://git.rapsys.eu/packbundle/blobdiff_plain/06e25924552ccb7dd05880ed38aecd86bbda49e8..a951f3cdbb523bf6598477d87d49aa454ab4818d:/Asset/PathPackage.php diff --git a/Asset/PathPackage.php b/Asset/PathPackage.php index 371ffcc..1a975c5 100644 --- a/Asset/PathPackage.php +++ b/Asset/PathPackage.php @@ -31,18 +31,21 @@ class PathPackage extends BasePackage { } /** + * @todo Try retrive public dir from the member function BundleNameBundle::getPublicDir() return value ? + * @xxx see https://symfony.com/doc/current/bundles.html#overridding-the-bundle-directory-structure * {@inheritdoc} */ public function getUrl($path) { //Match url starting with a bundle name - if (preg_match('%^@([A-Z][a-zA-Z]*)Bundle/Resources/public(/.*)$%', $path, $matches)) { + if (preg_match('%^@([A-Z][a-zA-Z]*?)(?:Bundle/Resources/public)?/(.*)$%', $path, $matches)) { //Handle empty or without replacement pattern basePath if (empty($this->basePath) || strpos($this->basePath, '%s') === false) { //Set path from hardcoded format - $path = '/bundles/'.strtolower($matches[1]).$matches[2]; + $path = '/bundles/'.strtolower($matches[1]).'/'.$matches[2]; //Proceed with basePath pattern replacement } else { //Set path from basePath pattern + //XXX: basePath has a trailing / added by constructor $path = sprintf($this->basePath, strtolower($matches[1])).$matches[2]; } }