From 67697c60cba5a5a0300b8ae6bfbf1b758bd5eaaa Mon Sep 17 00:00:00 2001 From: Warnar Boekkooi Date: Wed, 25 Sep 2013 19:54:28 +0200 Subject: [PATCH] Fixed a problem when getSourcePath can contain a directory When using phiamo/MopaBootstrapBundle and using: ``` {% stylesheets filter="assetdirectory" '@MopaBootstrapBundle/Resources/bootstrap/less/bootstrap.less' {% endstylesheets %} ``` A `[error] File "/glyphicons-halflings-regular.eot" does not exist` was thrown. This was due to `getSourcePath()` containing a directory. Sorry I don't have time to check/write a test for this at the moment. Will do it later if you want. --- Assetic/Util/PathUtils.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assetic/Util/PathUtils.php b/Assetic/Util/PathUtils.php index fe9c630..88d5fd2 100644 --- a/Assetic/Util/PathUtils.php +++ b/Assetic/Util/PathUtils.php @@ -57,7 +57,7 @@ public static function resolveUrl(AssetInterface $asset, $url) return $url; } - $root = $asset->getSourceRoot(); + $root = dirname($asset->getSourceRoot().'/'.$asset->getSourcePath()); $path = dirname($asset->getTargetPath()); if ('.' === $path) { @@ -67,7 +67,7 @@ public static function resolveUrl(AssetInterface $asset, $url) } if (null !== $root) { - $image = $root.'/'.$image; + $image = $root.'/'.$url; } // cleanup local URLs