mangaRepository->findVisibleChapterById($query->chapterId); if (!$chapter) { throw new ChapterNotFoundException($query->chapterId); } if (!$chapter->isAvailable()) { throw new ChapterNotAvailableException($query->chapterId); } $pagesDirectory = $chapter->getPagesDirectory(); $filename = basename($pagesDirectory); try { $httpResponse = $this->fileService->downloadCbz($pagesDirectory, $filename); } catch (CbzFileNotFoundException $e) { throw new ChapterNotAvailableException($query->chapterId); } return new DownloadResponse($httpResponse); } }