fix(manga): générer le CBZ de téléchargement depuis les dossiers de pages
Les endpoints de téléchargement chapitre/volume plantaient (500 "file does not exist") car le FileService traitait `pagesDirectory` comme un CBZ. Le service reconstruit maintenant l'archive à la volée à partir des images du dossier, et le nom du fichier chapitre inclut le titre du manga et le numéro. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -27,7 +27,7 @@ class DownloadCbzTest extends AbstractApiTestCase
|
||||
'number' => 1.0,
|
||||
'title' => 'Chapter 1',
|
||||
'visible' => true,
|
||||
'cbzPath' => '/app/tests/Shared/Files/test-chapter.cbz',
|
||||
'pagesDirectory' => '/app/tests/Shared/Files/test-pages',
|
||||
]);
|
||||
|
||||
$chapterId = $chapter->getId();
|
||||
@@ -41,7 +41,7 @@ class DownloadCbzTest extends AbstractApiTestCase
|
||||
$response = static::getClient()->getResponse();
|
||||
$this->assertEquals('application/x-cbz', $response->headers->get('Content-Type'));
|
||||
$this->assertStringContainsString('attachment; filename=', $response->headers->get('Content-Disposition'));
|
||||
$this->assertStringContainsString('test-chapter.cbz', $response->headers->get('Content-Disposition'));
|
||||
$this->assertStringContainsString('Ch.001.cbz', $response->headers->get('Content-Disposition'));
|
||||
}
|
||||
|
||||
public function testItReturns404ForNonExistentChapter(): void
|
||||
|
||||
@@ -27,7 +27,7 @@ class DownloadVolumeTest extends AbstractApiTestCase
|
||||
'manga' => $manga,
|
||||
'volume' => 1,
|
||||
'visible' => true,
|
||||
'cbzPath' => __DIR__.'/../../Shared/Files/test-chapter.cbz',
|
||||
'pagesDirectory' => __DIR__.'/../../Shared/Files/test-pages',
|
||||
]);
|
||||
|
||||
$mangaId = $manga->getId();
|
||||
@@ -108,7 +108,7 @@ class DownloadVolumeTest extends AbstractApiTestCase
|
||||
'volume' => 1,
|
||||
'number' => 1.0,
|
||||
'visible' => true,
|
||||
'cbzPath' => __DIR__.'/../../Shared/Files/test-chapter.cbz',
|
||||
'pagesDirectory' => __DIR__.'/../../Shared/Files/test-pages',
|
||||
]);
|
||||
|
||||
ChapterFactory::createOne([
|
||||
@@ -116,7 +116,7 @@ class DownloadVolumeTest extends AbstractApiTestCase
|
||||
'volume' => 1,
|
||||
'number' => 2.0,
|
||||
'visible' => false, // Soft deleted
|
||||
'cbzPath' => __DIR__.'/../../Shared/Files/test-chapter.cbz',
|
||||
'pagesDirectory' => __DIR__.'/../../Shared/Files/test-pages',
|
||||
]);
|
||||
|
||||
ChapterFactory::createOne([
|
||||
@@ -132,7 +132,7 @@ class DownloadVolumeTest extends AbstractApiTestCase
|
||||
'volume' => 1,
|
||||
'number' => 4.0,
|
||||
'visible' => true,
|
||||
'cbzPath' => __DIR__.'/../../Shared/Files/test-chapter.cbz',
|
||||
'pagesDirectory' => __DIR__.'/../../Shared/Files/test-pages',
|
||||
]);
|
||||
|
||||
$mangaId = $manga->getId();
|
||||
|
||||
BIN
tests/Shared/Files/test-pages/0001.png
Normal file
BIN
tests/Shared/Files/test-pages/0001.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 B |
BIN
tests/Shared/Files/test-pages/0002.png
Normal file
BIN
tests/Shared/Files/test-pages/0002.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 B |
Reference in New Issue
Block a user