[DomCrawler] Fix handling file:// without a host
This commit is contained in:
parent
839047bafa
commit
41399360e8
|
@ -120,7 +120,7 @@ class Link
|
|||
return $baseUri.$uri;
|
||||
}
|
||||
|
||||
$baseUri = preg_replace('#^(.*?//[^/]+)(?:\/.*)?$#', '$1', $this->currentUri);
|
||||
$baseUri = preg_replace('#^(.*?//[^/]*)(?:\/.*)?$#', '$1', $this->currentUri);
|
||||
|
||||
// absolute path
|
||||
if ('/' === $uri[0]) {
|
||||
|
|
|
@ -118,6 +118,11 @@ class LinkTest extends \PHPUnit_Framework_TestCase
|
|||
array('../bar/./../../foo', 'http://localhost/bar/foo/', 'http://localhost/foo'),
|
||||
array('../../', 'http://localhost/', 'http://localhost/'),
|
||||
array('../../', 'http://localhost', 'http://localhost/'),
|
||||
|
||||
array('/foo', 'file:///', 'file:///foo'),
|
||||
array('/foo', 'file:///bar/baz', 'file:///foo'),
|
||||
array('foo', 'file:///', 'file:///foo'),
|
||||
array('foo', 'file:///bar/baz', 'file:///bar/foo'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue