api(server): fix undefined header

This commit is contained in:
Matthew Penner 2022-11-21 13:15:49 -07:00
parent 2f4a60c961
commit c3521e0221
No known key found for this signature in database

View file

@ -2,6 +2,7 @@
namespace Pterodactyl\Repositories\Wings; namespace Pterodactyl\Repositories\Wings;
use Illuminate\Support\Arr;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
@ -35,8 +36,7 @@ class DaemonFileRepository extends DaemonRepository
throw new DaemonConnectionException($exception); throw new DaemonConnectionException($exception);
} }
$length = (int) $response->getHeader('Content-Length')[0] ?? 0; $length = (int) Arr::get($response->getHeader('Content-Length'), 0, 0);
if ($notLargerThan && $length > $notLargerThan) { if ($notLargerThan && $length > $notLargerThan) {
throw new FileSizeTooLargeException(); throw new FileSizeTooLargeException();
} }