diff --git a/src/Utils/Downloader/DownloaderDirect.php b/src/Utils/Downloader/DownloaderDirect.php index e6974bf..f265bfb 100644 --- a/src/Utils/Downloader/DownloaderDirect.php +++ b/src/Utils/Downloader/DownloaderDirect.php @@ -51,7 +51,11 @@ public function speed(int $speed): self */ public function get(): void { - $this->size = filesize($this->path); + try { + $this->size = filesize($this->path); + } catch (\Throwable $th) { + throw new \Exception("File not found: {$this->path}"); + } ini_set('max_execution_time', $this->maxExecutionTime); $this->sendHeaders(); diff --git a/src/Utils/Downloader/DownloaderZipStream.php b/src/Utils/Downloader/DownloaderZipStream.php index 71aacc6..bc69159 100644 --- a/src/Utils/Downloader/DownloaderZipStream.php +++ b/src/Utils/Downloader/DownloaderZipStream.php @@ -46,6 +46,10 @@ public function get(): void ); foreach ($this->files as $file) { + if (! file_exists($file->path)) { + throw new \Exception("File not found: {$file->path}"); + } + $zip->addFileFromPath( fileName: $file->fileName, path: $file->path,