From 0fb8794285efee3e8627a0d7f38eee2e68525c15 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Tue, 26 Nov 2019 21:00:59 +0100 Subject: [PATCH 1/1] Add shortcut @Name internaly fixed to canonical @NameBundle/Resources/public Fix extra trailing / Add not about trailing / --- Asset/PathPackage.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Asset/PathPackage.php b/Asset/PathPackage.php index 371ffcc..5fa69e2 100644 --- a/Asset/PathPackage.php +++ b/Asset/PathPackage.php @@ -35,14 +35,15 @@ class PathPackage extends BasePackage { */ 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]; } } -- 2.41.0