Update MediaStorageService, improve head checks to fix failed jobs

This commit is contained in:
Daniel Supernault 2021-02-17 01:09:39 -07:00
parent 850e4499f1
commit 1769cdfd74
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -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]