mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
Update MediaStorageService
This commit is contained in:
parent
ab9a8ba314
commit
d6374cfe70
2 changed files with 6 additions and 4 deletions
|
@ -84,7 +84,7 @@ class RemoteAvatarFetchFromUrl implements ShouldQueue
|
||||||
$avatar->save();
|
$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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ class MediaStorageService {
|
||||||
unlink($tmpName);
|
unlink($tmpName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function fetchAvatar($avatar, $local = false)
|
protected function fetchAvatar($avatar, $local = false, $skipRecentCheck = false)
|
||||||
{
|
{
|
||||||
$url = $avatar->remote_url;
|
$url = $avatar->remote_url;
|
||||||
$driver = $local ? 'local' : config('filesystems.cloud');
|
$driver = $local ? 'local' : config('filesystems.cloud');
|
||||||
|
@ -215,9 +215,11 @@ class MediaStorageService {
|
||||||
$mime = $head['mime'];
|
$mime = $head['mime'];
|
||||||
$max_size = (int) config('pixelfed.max_avatar_size') * 1000;
|
$max_size = (int) config('pixelfed.max_avatar_size') * 1000;
|
||||||
|
|
||||||
|
if(!$skipRecentCheck) {
|
||||||
if($avatar->last_fetched_at && $avatar->last_fetched_at->gt(now()->subDay())) {
|
if($avatar->last_fetched_at && $avatar->last_fetched_at->gt(now()->subDay())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// handle pleroma edge case
|
// handle pleroma edge case
|
||||||
if(Str::endsWith($mime, '; charset=utf-8')) {
|
if(Str::endsWith($mime, '; charset=utf-8')) {
|
||||||
|
|
Loading…
Reference in a new issue