From 655270fafddec6843f7780251b5cc40e1eafdfb7 Mon Sep 17 00:00:00 2001 From: Alx Date: Thu, 24 Dec 2015 13:24:52 +0300 Subject: [PATCH] FIx wrong path creation in css pack If you have several files of one font, for ex.: `url(fonts/font.woff)` `url(fonts/font.woff2)` It's pack to this: ``` url(/design/siteaccess/stylesheets/fonts/font.woff) url(/design/siteaccess/stylesheets//design/siteaccess/stylesheets/fonts/font.woff2) ``` The commit fix this bug. --- extension/ezjscore/classes/ezjscpacker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/ezjscore/classes/ezjscpacker.php b/extension/ezjscore/classes/ezjscpacker.php index 0a196152865..3068427d8c3 100644 --- a/extension/ezjscore/classes/ezjscpacker.php +++ b/extension/ezjscore/classes/ezjscpacker.php @@ -515,7 +515,7 @@ static function fixImgPaths( $fileContent, $file ) $newMatchPath .= implode( '/', $cssPathSlice ) . '/'; } $newMatchPath .= str_replace( '../', '', $match ); - $fileContent = str_replace( $match, $newMatchPath, $fileContent ); + $fileContent = preg_replace( "/url\(\s*[\'|\"]?".preg_quote($match, '/')."[\'|\"]?\s*\)/", "url($newMatchPath)", $fileContent ); } } }