feat(OpdsFeedService): detect ZIP mime type for FB2 files when zipped (#2242)
Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
This commit is contained in:
+16
@@ -135,6 +135,22 @@ class OpdsFeedServiceMimeTypeTest {
|
||||
assertThat(xml).contains("type=\"application/x-fictionbook+xml\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMimeTypeForZippedFb2() throws IOException {
|
||||
File zipAsFb2 = tempDir.resolve("book_zipped.fb2").toFile();
|
||||
try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipAsFb2))) {
|
||||
zos.putNextEntry(new ZipEntry("book.fb2"));
|
||||
zos.write("<FictionBook>...</FictionBook>".getBytes());
|
||||
zos.closeEntry();
|
||||
}
|
||||
|
||||
Book book = createBook(BookFileType.FB2, "book_zipped.fb2");
|
||||
mockBooksPage(book);
|
||||
|
||||
String xml = opdsFeedService.generateCatalogFeed(request);
|
||||
assertThat(xml).contains("type=\"application/zip\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMimeTypeForZipNamedAsCbr() throws IOException {
|
||||
// Create a ZIP file named .cbr
|
||||
|
||||
Reference in New Issue
Block a user