Check the image URL has a host before retrieving it in Photo::importProfilePhoto

- Address https://github.com/friendica/friendica/issues/12486#issuecomment-1404324012
This commit is contained in:
Hypolite Petovan 2023-01-25 22:31:07 -05:00
parent 0259af1118
commit be105db759

View file

@ -583,7 +583,7 @@ class Photo
$photo_failure = false; $photo_failure = false;
$filename = basename($image_url); $filename = basename($image_url);
if (!empty($image_url)) { if (!empty($image_url) && @parse_url($image_url, PHP_URL_HOST)) {
$ret = DI::httpClient()->get($image_url, HttpClientAccept::IMAGE); $ret = DI::httpClient()->get($image_url, HttpClientAccept::IMAGE);
Logger::debug('Got picture', ['Content-Type' => $ret->getHeader('Content-Type'), 'url' => $image_url]); Logger::debug('Got picture', ['Content-Type' => $ret->getHeader('Content-Type'), 'url' => $image_url]);
$img_str = $ret->getBody(); $img_str = $ret->getBody();