diff --git a/Imagine/Cache/CacheManager.php b/Imagine/Cache/CacheManager.php index 89d1b2bcd..3145f8f41 100644 --- a/Imagine/Cache/CacheManager.php +++ b/Imagine/Cache/CacheManager.php @@ -123,9 +123,12 @@ public function getBrowserPath($targetPath, $filter, $absolute = false) public function generateUrl($targetPath, $filter, $absolute = false) { $config = $this->filterConfig->get($filter); + if (isset($config['format'])) { $pathinfo = pathinfo($targetPath); - if ($pathinfo['extension'] !== $config['format']) { + // the extension should be forced and a directory is detected + if ((!isset($pathinfo['extension']) || $pathinfo['extension'] !== $config['format']) + && isset($pathinfo['dirname'])) { $targetPath = $pathinfo['dirname'].'/'.$pathinfo['filename'].'.'.$config['format']; } }