mirror of
https://github.com/friendica/friendica
synced 2025-05-21 15:04:12 +02:00
Avoid more local links and bad http requests
This commit is contained in:
parent
fc46778a00
commit
999cdc7db9
11 changed files with 62 additions and 81 deletions
|
@ -2204,13 +2204,18 @@ class Contact
|
|||
return;
|
||||
}
|
||||
|
||||
if (!Network::isValidHttpUrl($avatar)) {
|
||||
Logger::warning('Invalid avatar', ['cid' => $cid, 'avatar' => $avatar]);
|
||||
$avatar = '';
|
||||
}
|
||||
|
||||
$uid = $contact['uid'];
|
||||
|
||||
// Only update the cached photo links of public contacts when they already are cached
|
||||
if (($uid == 0) && !$force && empty($contact['thumb']) && empty($contact['micro']) && !$create_cache) {
|
||||
if (($contact['avatar'] != $avatar) || empty($contact['blurhash'])) {
|
||||
$update_fields = ['avatar' => $avatar];
|
||||
if (!Network::isLocalLink($avatar) && Network::isValidHttpUrl($avatar)) {
|
||||
if (!Network::isLocalLink($avatar)) {
|
||||
$fetchResult = HTTPSignature::fetchRaw($avatar, 0, [HttpClientOptions::ACCEPT_CONTENT => [HttpClientAccept::IMAGE]]);
|
||||
|
||||
$img_str = $fetchResult->getBody();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue