Skip to content

Commit

Permalink
Update MediaStorageService, improve head checks to fix failed jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Feb 17, 2021
1 parent 850e449 commit 1769cdf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/Services/MediaStorageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,18 @@ public static function head($url)
} 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]
Expand Down

0 comments on commit 1769cdf

Please sign in to comment.