Only use comic pages for internal calculations

A comic book archive stores pages as images, but can store other
information like metadata within the file, too.

This change uses only the image based files as pages and ignores other
files.
This commit is contained in:
Patrick Farwick 2022-01-22 01:00:03 +00:00
parent 390d9cc213
commit 14083377d1

View File

@ -259,7 +259,15 @@ class ArchiveSource {
this.raw = await this.archive.getFilesArray();
await this.archive.extractFiles();
const files = await this.archive.getFilesArray();
// the comic book archive supports any kind of image format as it's just a zip archive
const supportedFormats = ['jpg', 'png', 'avif', 'gif', 'bmp', 'dib', 'tiff', 'tif'];
let files = await this.archive.getFilesArray();
files = files.filter((file) => {
const name = file.file.name;
const index = name.lastIndexOf('.');
return supportedFormats.includes(name.substr(index + 1));
});
files.sort((a, b) => {
if (a.file.name < b.file.name) {
return -1;