kopia lustrzana https://github.com/pixelfed/pixelfed
Update MediaStorageService, improve support for pleroma .blob avatars
rodzic
aaed2bf66e
commit
66226658db
|
@ -203,6 +203,7 @@ class MediaStorageService {
|
|||
}
|
||||
|
||||
$mimes = [
|
||||
'application/octet-stream',
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
];
|
||||
|
@ -239,6 +240,15 @@ class MediaStorageService {
|
|||
}
|
||||
file_put_contents($tmpName, $data);
|
||||
|
||||
$mimeCheck = Storage::mimeType('remcache/' . $tmpPath);
|
||||
|
||||
if(!$mimeCheck || !in_array($mimeCheck, ['image/png', 'image/jpeg'])) {
|
||||
$avatar->last_fetched_at = now();
|
||||
$avatar->save();
|
||||
unlink($tmpName);
|
||||
return;
|
||||
}
|
||||
|
||||
$disk = Storage::disk($driver);
|
||||
$file = $disk->putFileAs($base, new File($tmpName), $path, 'public');
|
||||
$permalink = $disk->url($file);
|
||||
|
|
Ładowanie…
Reference in New Issue