mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
fix: misc suggested changes
* disable resolve_relative_css_refs by default * variable naming * using proper path joiner * test comment typo
This commit is contained in:
parent
bc9a323418
commit
ebb1601d5d
@ -65,7 +65,7 @@ class Requirements_Backend
|
||||
* @config
|
||||
* @var bool
|
||||
*/
|
||||
private static $resolve_relative_css_refs = true;
|
||||
private static $resolve_relative_css_refs = false;
|
||||
|
||||
/**
|
||||
* Paths to all required JavaScript files relative to docroot
|
||||
@ -1456,11 +1456,11 @@ MESSAGE
|
||||
$fileUrl = Injector::inst()->get(ResourceURLGenerator::class)->urlForResource($filePath);
|
||||
$fileUrlDir = dirname($fileUrl);
|
||||
$content = preg_replace_callback('#(url\([\n\r\s\'"]*)([^\s\)\?\'"]+)#i', function ($match) use ($fileUrlDir) {
|
||||
[ $_, $prefix, $relativePath ] = $match;
|
||||
[ $fullMatch, $prefix, $relativePath ] = $match;
|
||||
if ($relativePath[0] === '/' || false !== strpos($relativePath, '://')) {
|
||||
return $prefix . $relativePath;
|
||||
}
|
||||
$full = FilesystemPath::canonicalize($fileUrlDir . '/' . $relativePath);
|
||||
$full = FilesystemPath::canonicalize(FilesystemPath::join($fileUrlDir, $relativePath));
|
||||
return $prefix . $full;
|
||||
}, $content);
|
||||
return $content;
|
||||
|
@ -280,7 +280,7 @@ class RequirementsTest extends SapphireTest
|
||||
$this->assertStringContainsString(
|
||||
".p4 { background: url(/four.gif); }",
|
||||
$content,
|
||||
'combined css url resolver decoded 4 double-dot when only 4 levels available'
|
||||
'combined css url resolver decoded 4 double-dot when only 3 levels available'
|
||||
);
|
||||
|
||||
/* COMBINED CSS URL RESOLVER MODIFIED AN ARBITRARY VALUE */
|
||||
|
Loading…
Reference in New Issue
Block a user