1
0
Fork 0

Update MediaStorageService

This commit is contained in:
Daniel Supernault 2023-06-06 05:54:49 -06:00
parent ab9a8ba314
commit d6374cfe70
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
2 changed files with 6 additions and 4 deletions

View File

@ -84,7 +84,7 @@ class RemoteAvatarFetchFromUrl implements ShouldQueue
$avatar->save();
}
MediaStorageService::avatar($avatar, boolval(config_cache('pixelfed.cloud_storage')) == false);
MediaStorageService::avatar($avatar, boolval(config_cache('pixelfed.cloud_storage')) == false, true);
return 1;
}

View File

@ -191,7 +191,7 @@ class MediaStorageService {
unlink($tmpName);
}
protected function fetchAvatar($avatar, $local = false)
protected function fetchAvatar($avatar, $local = false, $skipRecentCheck = false)
{
$url = $avatar->remote_url;
$driver = $local ? 'local' : config('filesystems.cloud');
@ -215,8 +215,10 @@ class MediaStorageService {
$mime = $head['mime'];
$max_size = (int) config('pixelfed.max_avatar_size') * 1000;
if($avatar->last_fetched_at && $avatar->last_fetched_at->gt(now()->subDay())) {
return;
if(!$skipRecentCheck) {
if($avatar->last_fetched_at && $avatar->last_fetched_at->gt(now()->subDay())) {
return;
}
}
// handle pleroma edge case