mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Module resource regex does not allow ports
This commit is contained in:
parent
64005bff91
commit
c836a2e2d2
@ -643,7 +643,7 @@ class Requirements_Backend
|
||||
protected function parseModuleResourceReference($file)
|
||||
{
|
||||
// String of the form vendor/package:resource. Excludes "http://bla" as that's an absolute URL
|
||||
if (preg_match('#([^ ]*/[^ ]*) *: *([^ ]*)#', $file, $matches)) {
|
||||
if (preg_match('#([^\/\/][^ /]*\/[^ /]*) *: *([^ ]*)#', $file, $matches)) {
|
||||
list(, $module, $resource) = $matches;
|
||||
$moduleObj = ModuleLoader::getModule($module);
|
||||
if (!$moduleObj) {
|
||||
|
@ -45,9 +45,11 @@ class RequirementsTest extends SapphireTest
|
||||
$backend->javascript('http://www.mydomain.com/test.js');
|
||||
$backend->javascript('https://www.mysecuredomain.com/test.js');
|
||||
$backend->javascript('//scheme-relative.example.com/test.js');
|
||||
$backend->javascript('http://www.mydomain.com:3000/test.js');
|
||||
$backend->css('http://www.mydomain.com/test.css');
|
||||
$backend->css('https://www.mysecuredomain.com/test.css');
|
||||
$backend->css('//scheme-relative.example.com/test.css');
|
||||
$backend->css('http://www.mydomain.com:3000/test.css');
|
||||
|
||||
$html = $backend->includeInHTML(self::$html_template);
|
||||
|
||||
@ -63,6 +65,10 @@ class RequirementsTest extends SapphireTest
|
||||
(strpos($html, '//scheme-relative.example.com/test.js') !== false),
|
||||
'Load external scheme-relative javascript URL'
|
||||
);
|
||||
$this->assertTrue(
|
||||
(strpos($html, 'http://www.mydomain.com:3000/test.js') !== false),
|
||||
'Load external with port'
|
||||
);
|
||||
$this->assertTrue(
|
||||
(strpos($html, 'http://www.mydomain.com/test.css') !== false),
|
||||
'Load external CSS URL'
|
||||
@ -75,6 +81,11 @@ class RequirementsTest extends SapphireTest
|
||||
(strpos($html, '//scheme-relative.example.com/test.css') !== false),
|
||||
'Load scheme-relative CSS URL'
|
||||
);
|
||||
$this->assertTrue(
|
||||
(strpos($html, 'http://www.mydomain.com:3000/test.css') !== false),
|
||||
'Load external with port'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user