Skip to content

Commit e6fe9c0

Browse files
committed
Fixed the image scanner in html provider
1 parent a383589 commit e6fe9c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Embed/Providers/Html.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,14 @@ public function __construct (Url $Url) {
122122
$Content = $Html;
123123
}
124124

125-
$host = $Url->getHost();
125+
$domain = $Url->getDomain();
126126

127127
foreach ($Content->getElementsByTagName('img') as $Tag) {
128128
if ($Tag->hasAttribute('src')) {
129129
$image = $Tag->getAttribute('src');
130130

131-
if (strpos($image, '://') && (strpos(parse_url($image, PHP_URL_HOST), $host) === false)) {
131+
//Check whether the image is in the same domain
132+
if ((strpos($image, '//') === false) || (($ImgUrl = new Url($image)) && ($ImgUrl->getDomain() !== $domain))) {
132133
continue;
133134
}
134135

0 commit comments

Comments
 (0)