Skip to content

Commit 8c740ce

Browse files
committed
fixed exception with invalid urls #302
1 parent 5a1677f commit 8c740ce

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Adapters/Adapter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Embed\Http\Url;
1111
use Embed\Providers\Provider;
1212
use Embed\Utils;
13+
use Exception;
1314

1415
/**
1516
* Base class extended by all adapters.
@@ -317,7 +318,11 @@ public function getUrl()
317318
return $this->getFirstFromProviders(function (Provider $provider) use ($blacklist, $homeUrl) {
318319
$url = $provider->getUrl();
319320

320-
if ($homeUrl === $url || (!empty($blacklist) && Url::create($url)->match($blacklist))) {
321+
try {
322+
if ($homeUrl === $url || (!empty($blacklist) && Url::create($url)->match($blacklist))) {
323+
return false;
324+
}
325+
} catch (Exception $error) {
321326
return false;
322327
}
323328

src/Http/Url.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ private static function getSuffixes()
621621
{
622622
if (self::$public_suffix_list === null) {
623623
self::$public_suffix_list = (array) include __DIR__.'/../resources/public_suffix_list.php';
624-
}
624+
}
625625
return self::$public_suffix_list;
626626
}
627627

0 commit comments

Comments
 (0)