diff options
-rw-r--r-- | app/php/web/ClientScriptManager.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/php/web/ClientScriptManager.php b/app/php/web/ClientScriptManager.php index 4b54be1..3b60b7a 100644 --- a/app/php/web/ClientScriptManager.php +++ b/app/php/web/ClientScriptManager.php @@ -322,15 +322,18 @@ class ClientScriptManager extends TClientScriptManager { ); } + // Resolve all "url(FILE)" CSS directives pointing to relative resources to specified path private function _fixStyleSheetPaths($content, $originalUrl) { $originalDir = dirname($originalUrl . '.'); return preg_replace_callback( '/url\s*\([\'"]?(.*?)[\'"]?\)/', function($matches) use($originalDir) { $url = parse_url($matches[1]); - if (isset($url['scheme']) || isset($url['host'])) { + // ignore absolute URLs and paths + if (isset($url['scheme']) || isset($url['host']) || $url['path'][0] == '/') { return $matches[0]; } + // resolve relative paths return str_replace( $matches[1], $originalDir . '/' . $matches[1], |