- $fetchResult = HTTPSignature::fetchRaw($avatar, 0, [HttpClientOptions::ACCEPT_CONTENT => [HttpClientAccept::IMAGE]]);
-
- $img_str = $fetchResult->getBody();
- if (!empty($img_str)) {
- $image = new Image($img_str, Images::getMimeTypeByData($img_str));
- if ($image->isValid()) {
- $update_fields['blurhash'] = $image->getBlurHash();
+ if (!Network::isLocalLink($avatar)) {
+ try {
+ $fetchResult = HTTPSignature::fetchRaw($avatar, 0, [HttpClientOptions::ACCEPT_CONTENT => [HttpClientAccept::IMAGE]]);
+
+ $img_str = $fetchResult->getBody();
+ if (!empty($img_str)) {
+ $image = new Image($img_str, Images::getMimeTypeByData($img_str));
+ if ($image->isValid()) {
+ $update_fields['blurhash'] = $image->getBlurHash();
+ } else {
+ return;
+ }
+ }
+ } catch (\Exception $exception) {
+ Logger::notice('Error fetching avatar', ['avatar' => $avatar, 'exception' => $exception]);
+ return;