mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-03 05:11:52 +00:00
This commit is contained in:
parent
1db36fb09d
commit
3fc193c755
@ -35,7 +35,7 @@ class HTMLPurifier_URIFilter_HostBlacklist extends HTMLPurifier_URIFilter
|
|||||||
public function filter(&$uri, $config, $context)
|
public function filter(&$uri, $config, $context)
|
||||||
{
|
{
|
||||||
foreach ($this->blacklist as $blacklisted_host_fragment) {
|
foreach ($this->blacklist as $blacklisted_host_fragment) {
|
||||||
if (strpos($uri->host, $blacklisted_host_fragment) !== false) {
|
if ($uri->host !== null && strpos($uri->host, $blacklisted_host_fragment) !== false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,12 @@ class HTMLPurifier_URIFilter_HostBlacklistTest extends HTMLPurifier_URIFilterHar
|
|||||||
$this->assertFiltering('http://google.com');
|
$this->assertFiltering('http://google.com');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFragment()
|
||||||
|
{
|
||||||
|
$this->config->set('URI.HostBlacklist', 'example.com');
|
||||||
|
$this->assertFiltering('#foo');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: et sw=4 sts=4
|
// vim: et sw=4 sts=4
|
||||||
|
Loading…
Reference in New Issue
Block a user