Update MediaStorageService, improve head checks to fix failed jobs

pull/2666/head
Daniel Supernault 2021-02-17 01:09:39 -07:00
rodzic 850e4499f1
commit 1769cdfd74
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
1 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -40,7 +40,18 @@ class MediaStorageService {
} catch (RequestException $e) {
return false;
}
$h = $r->getHeaders();
if (isset($h['Content-Length'], $h['Content-Type']) == false ||
empty($h['Content-Length']) ||
empty($h['Content-Type']) ||
$h['Content-Length'] < 10 ||
$h['Content-Length'] > (config('pixelfed.max_photo_size') * 1000)
) {
return false;
}
return [
'length' => $h['Content-Length'][0],
'mime' => $h['Content-Type'][0]