Fixed CSS url caching bug

pull/17/head
Frode Petterson 2016-01-25 14:49:29 +01:00
parent 73fd170a3a
commit 3defc7abde
1 changed files with 5 additions and 3 deletions

View File

@ -176,10 +176,12 @@ class H5PDefaultStorage implements \H5PFileStorage {
$content .= preg_replace_callback( $content .= preg_replace_callback(
'/url\([\'"]?([^"\')]+)[\'"]?\)/i', '/url\([\'"]?([^"\')]+)[\'"]?\)/i',
function ($matches) use ($cssRelPath) { function ($matches) use ($cssRelPath) {
return substr($matches[1], 0, 3) !== '../' ? $matches[0] : 'url("../' . $cssRelPath . $matches[1] . '")'; if (preg_match("/^([a-z0-9]+:)?\//i", $matches[1]) === 1) {
return $matches[0]; // Not relative, skip
}
return 'url("../' . $cssRelPath . $matches[1] . '")';
}, },
$assetContent $assetContent) . "\n";
) . "\n";
} }
} }